List current asset ID
Listing assets within Matrix expose a list_current_asset_id
session variable, containing the asset ID of a currently listed asset.
You can use this variable on nested asset listing pages to display additional information from the children of listed assets.
Example: Listing related images
You can use the list_current_asset_id
session variable to display corresponding images on an asset listing alongside listed assets.
In this example, we are listing information on a range of Squiz Suite products. Each of these products is a standard page asset that contains a child image asset of the product logo. We want to include these logo images alongside our assets in the asset listing.
-
Create an asset listing page under your site
This will be our parent listing. -
Configure the parent listing to list your product standard page assets
-
Create a new asset listing page
This will be our child listing. You can create this asset anywhere in your system. -
Configure the child listing to list the logo image assets
-
Create a new Replacement root node for the listing type dynamic parameter on the child listing with the session variable
list_current_asset_id
. -
Edit the item format in the child listing’s default format bodycopy so that your images are displayed on the listing
-
To nest the child listing within the parent listing:
-
Create a new Nest content type content division in the default format bodycopy of the parent listing.
-
Nest the child listing in this division.
The parent listing will now contain the logo images for each product asset.
-
You can modify the default format bodycopy of the parent listing (including the location of the child listing) to configure your images and product standard pages on the asset listing page.
You can use this basic example as a concept to create more complex listings, displaying multiple images for listed assets over several levels. |
Example: Advanced grouping
The asset listing page’s grouping options allow you to list assets under several specified groups, over multiple levels. However, these options can be restrictive and do not allow for individual group level formatting.
The list_current_asset_id session variable can be used to create asset groups with more advanced options, such as formatting the individual group levels and displaying grouped assets as list items.
In this example, we are listing information on a range of Squiz Suite products. Each of these products is a standard page asset that contains a child and grandchild assets. We want to include these assets as an unordered list on our asset listing.
-
Create an asset listing page under your site
This will be our top-level listing. -
Configure the top-level listing to list the standard page assets under your site
-
Create a new asset listing page
This will be our second level listing. You can create this asset anywhere in your system. Like our top-level listing, configure the second level listing to list the standard page assets under your site. -
Create a new Replacement root node for the listing type dynamic parameter on the second level listing with the session variable
list_current_asset_id
-
To nest the second level listing within the top-level listing.
-
Create a new Nest content type content division in the default format bodycopy of the top-level listing.
-
Nest the second level listing in this division.
The top-level listing will now contain the child assets for each product asset.
-
-
Repeat the above steps to nest a third-level listing (configured with the list_current_asset_id session variable) within the second-level listing. This action will effectively add another level to our top-level listing.
You can modify the default format bodycopies of your listings to configure the information shown for each listing level. In this example, we have added additional assets to the third level of our listing to display our products' features.
Use this example to create more complex listings with additional group levels and formatting. |