Has anyone got a way to combine either a conditional keyword or server side javascript and nested content?
I’m suspecting I need to do something with %globals_asset_contents_raw:$nested-asset-id% ?
Has anyone got a way to combine either a conditional keyword or server side javascript and nested content?
I’m suspecting I need to do something with %globals_asset_contents_raw:$nested-asset-id% ?
I would use %globals_site_children_link_type_1% but we’re no on 5.4.2.2 and while we need to schedule another upgrade this year, I may not be able to delay the site release that this question is inspired by.
I’ve used SSJS in an asset listing page, default format. Something like this:
if("%asset_metadata_fieldname%" === "yes") {
print("<li>%asset_name_linked%</li>");
}
This works well. Note you must put the keyword replacements inside quotes.
I debugged my code with the read every line backwards method and found a slight glitch with what I had (%globals_assets… instead of %globals_asset…) - working code is:
<script runat="server">
var _pageLevel = %frontend_asset_url_path^explode:/^count^subtract:1%;
if(_pageLevel > 2){
var _childListing = '%globals_asset_contents_raw:' + '353973' + '%';
print(_childListing);
}
</script>
The _pageLevel var was sourced from the Dynamic Title Tags Using Server Side JS tutorial