Getting the web path by asset ID


(Squiz) #1

Another seemingly inane question: Is it possible to load an asset (with a paint layout and design) using an asset ID alone?


I've tried

    ?a=112791&SQ_PAINT_LAYOUT_NAME=blast&SQ_DESIGN_NAME=flurry
while specifying a user-defined layout and design. Unfortunately this isn't a legitimate web path for the asset, so I can't actually get the user-defined bits working.



I've tried to get the url with the
    getWebPath()
function in the JS API, but it only returns the final snippet and not the actual uri for the asset. I can't use the SOAP service because it's giving me PHP errors, but I expect it would be roughly the same thing.



I'm thinking I may be approaching things the wrong way. Does anyone else have any ideas as to how to achieve this goal/folly?

(Squiz) #2

Woop, just answered my own question: Specify the [font="Lucida Console"]?a=[/font] query parameter on top of an asset with the desired layout & design already applied.


This way the design & layout for the web path sans-query-string will apply on whichever asset you load with the query string. I think.


(Nic Hubbard) #3

Have you tried the getGeneral() function to see what that returns, the web_path key should be what you want? The php for returning the full url to an asset is super simple, so if this is not a feature, it could be added in seconds.


(Squiz) #4

[quote]
Have you tried the getGeneral() function

[/quote]



Ah, getGeneral works perfectly. I now have two solutions to my problem, I'm pretty happy. Thanks. :slight_smile:


(David Wallace) #5

Hi

Is there a way I can get the same without using JS?

I’m trying to generate a hyperlink from an asset_id that will open Edit+ straight into that asset. Yet if I could use a keyword or something that returned the web path of the asset_id I’d be sweet.

Thanks


(Marcus Fong) #6

The globals_asset_url keyword might be what you’re looking for - try:

%globals_asset_url:<assetid>%

and see if that’s what you want.


(David Wallace) #7

That’s it.

I thought I’d seen a keyword somewhere but couldn’t find it when I needed.

Thanks for that, works superb.