Passing multiple get variables in a single keyword


(Erwin Strobel) #1

Hello,

I am wondering if there is a way to pass multiple get variables through to an asset listing.
I’ve was thibnnking maybe using server side js:

e.g. the following works for a single variable (folderId):
var folderId = %asset_metadata_banner-folder%;
print(’%’ + ‘globals_asset_contents:3217426^with_get:banner=’ + folderId + ‘%’);

was hoping to achieve sending though two variables: folderId and layoutId withing the one keyword

cheers


(Harinder Singh) #2

You can do something like

%globals_asset_contents:3217426^with_get:banner=12345&layoutid=67890%

I am not sure on how you can achieve this with SSJS. I was struggling with similar issue in past.


(Erwin Strobel) #3

Thank you so much,

was able to get it working with your suggestion :slight_smile:

<script runat="server">		            
var bannerID = %asset_metadata_banner-folder%
var number = %asset_metadata_layout_key%
print('%' + 'globals_asset_contents:3218704^with_get:banner=' + bannerID + '&layoutid=' + number + '%');
</script>

(John gill) #4

You should also be able to achieve this without SSJS by using the 5.4 version of the old ^replace_keywords modifier

%globals_asset_contents:3218704^with_get:banner={asset_metadata_banner-folder}&layoutid={asset_metadata_layout_key}%

https://matrix.squiz.net/manuals/keyword-replacements/chapters/keyword-modifiers#Using-Keyword-Replacements-as-Argument-Values