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.

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.

  1. Create an asset listing page under your site
    This will be our parent listing.

  2. Configure the parent listing to list your product standard page assets

  3. Create a new asset listing page
    This will be our child listing. You can create this asset anywhere in your system.

  4. Configure the child listing to list the logo image assets

  5. Create a new Replacement root node for the listing type dynamic parameter on the child listing with the session variable list_current_asset_id.

  6. Edit the item format in the child listing’s default format bodycopy so that your images are displayed on the listing

  7. To nest the child listing within the parent listing:

    1. Create a new Nest content type content division in the default format bodycopy of the parent listing.

    2. 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.

  1. Create an asset listing page under your site
    This will be our top-level listing.

  2. Configure the top-level listing to list the standard page assets under your site

  3. 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.

  4. 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

  5. To nest the second level listing within the top-level listing.

    1. Create a new Nest content type content division in the default format bodycopy of the top-level listing.

    2. Nest the second level listing in this division.

      The top-level listing will now contain the child assets for each product asset.

  6. 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.