This one is fairly interesting, I’m not entirely certain what’s going on but:
with_get
definitely works with globals_asset_contents_raw
You can set up a simple example where you include an Asset Listing via a keyword and supply a get param then use that param inside the Asset Listing with %nested_get
and see that it works.
Host page = %globals_asset_contents_raw:792^with_get:Param1=asd%
Listing (#792) = %nested_get_Param1%
- You can supply the sort parameters when using a Nest Content Container
If you pass the page_asset_listing_792_sort_by
and page_asset_listing_792_sort_direction
values in to a Nest Content Container the old fashion way, the sorting works.
- For some reason, those parameters do not work via
with_get
When you try both at the same time, the sorting doesn’t work (as you observed). The parameters are definitely getting through, because you can check them with %nested_get_page_asset_listing_792_sort_by%
, but the sorting just doesn’t happen.
%globals_asset_contents_raw:792^with_get:page_asset_listing_792_sort_direction=0&page_asset_listing_792_sort_by=3%
So we know we can pass values from keyword to a Nest Container, and from a Nest Container to an Asset Listing, let’s do something terrible.
- Create your listing with the asset sorting settings (#792)
- Create a shim page with a Nested Content Container (#813)
- Nest the listing in the shim page and set up two parameters to pass the sort_by and sort_direction through
- Lastly, use your globals keyword to bring the shim page into the SSJS in your actual page
<script runat="server">
var source = "%globals_asset_contents_raw:813^with_get:page_asset_listing_792_sort_direction=0&page_asset_listing_792_sort_by=3^json_encode%";
print(source);
var source2 = "%globals_asset_contents_raw:813^with_get:page_asset_listing_792_sort_direction=1&page_asset_listing_792_sort_by=1^json_encode%";
print(source2);
</script>
This snippet includes the same listing twice with different sort settings.
Caveats
- You probably want to exempt both your Shim and your Listing from caching in Cache Manager, lest you ruin your day. Assuming the pages are never accessed directly this shouldn’t have any adverse effects.