Listing Link assets in a menu_normal design area


(Steve Brown) #1

Hi guys,

 

we are listing a couple of link assets in a menu_normal design area and they arent working as desired.  They are going to an intermediate page with the link on them rather than going to the destination URL of the link asset itself.

 

Is there any way to use some of the new functionality mentioned by Bart in this post:

 

http://forums.squizsuite.net/index.php?showtopic=12870&p=56122

 

to change the behavior when listing Link assets ie use the destination URL of the link asset rather than use the URL of the actual link asset?

 

Thanks,

 

Steve.

 

 


(Tim Davison) #2

Never used link assets to get that behaviour, I’ve always used redirect assets. Menu still pushes you to the redirects own url but then user automatically pushed elsewhere.

Bart’s instructions look pretty detailed. What happens when you follow them?


(Steve Brown) #3

I havent followed Barts instructions as they arent exactly what I need - something similar perhaps but I cant find any doco to work with.

 

We may have to use Redirect assets too (we've used them in the past) but think Link assets are more appropriate and was hoping that the new version might have some improved functionality to allow them to be used.


(Peter McLeod) #4

Hi

 

Are you using the 'asset_url' keyword to set the url for the link?

 

If so - then maybe try using 'link_url' attribute of the link asset instead.

 

Haven't tried this in a menu normal design area, but it's how you get the desitation url in other listings etc.

 

If the linked assets are mixed in with other asset types being listed, then you'd need to account for that.

 

I tend to favour using nested area in the design, that nests an asset listing for these sorts of thing (eg where menus start to get a bit more complex). You could then simply handle the keyword replacements differently for different asset types.

 

https://manuals.matrix.squizsuite.net/keyword-replacements/chapters/link

 

Thanks

Peter


(Steve Brown) #5

Thanks Peter,

 

but the issue is that (as far as I know) you cant distinguish between asset types in a menu_normal the same way you can in an asset listing - so you cant say "For link assets use the link_url but for all other assets use the asset_url".

 

Steve.


(Peter McLeod) #6

Sorry - just update my post above...

 

If the linked assets are mixed in with other asset types being listed, then you'd need to account for that.

 

I tend to favour using nested area in the design, that nests an asset listing for these sorts of thing (eg where menus start to get a bit more complex). You could then simply handle the keyword replacements differently for different asset types.

 

Thanks

Peter


(Steve Brown) #7

That must get tricky when you want to show the item in the menu that is currently active, or auto-expand the hierarchy of menu items.  Do you have issues there?


(Peter McLeod) #8

Yeah - really depends on the specific implementation though.

 

For a simple list could use just css: set a style that is dymaniclly generated based on the global assetid - eg:  

 

.asset-%globals_asset_assetid% { /* css for active item */ }

 

And in the nested listing just add: class="asset-%asset_assetid%"

 

Or if its more complex then just use javascript to do similar - get the active menu element by comparing ids or urls, and then get a reference to its parent if its a sub page and you need to expand/collapse etc etc.

 

Thanks

Peter


(Bart Banda) #9

Thanks Peter,

 

but the issue is that (as far as I know) you cant distinguish between asset types in a menu_normal the same way you can in an asset listing - so you cant say "For link assets use the link_url but for all other assets use the asset_url".

 

Steve.

 

Hey, you can actually do it, as you can use keyword modifiers in the print design area for each asset getting printed. So if I wanted to print the redirect asset url if that's the type of asset being listed in the menu, I use a keyword modifier to conditionally print that value, like so:

<MySource_PRINT var="asset_type^replace_keywords:contains:Redirect:{redirect_url}:{asset_url}" />

Same concept as if it's a link asset. Would that work for you?

 

More useful modifiers here: https://manuals.matrix.squizsuite.net/keyword-replacements/examples/useful-keyword-modifiers


(Steve Brown) #10

Perfect, will give it a try and see how I go.  Didnt realise the keyword modifiers were available.

 

Thanks,

 

Steve