content_path

content_path

This function can be used to show the categories and other content types that a product is assigned to. This function can also be used to list out related categories and other content types that are assigned to a specific content page. For example, if you wanted to associate a blog post to a product or web page, this function can be used to display information about these linked posts on the page itself.

Example

[%content_path content_id:'[@content_id@]' show_path:'y' %]
    [%param *header%]
        content content_path header
    [%/param%]
    [%param *body%]
        [@content_name@] : [@content_id@]
    [%/param%]
    [%param *footer%]
        content content_path footer
    [%/param%]
[%/content_path%]

Usage

The content_path tag lists all content relating to the product or content either specified or currently selected.

Displaying the brand or category a product belongs to

You can display the category a product belongs to in a specific content type by configuring the code below.

[%content_path id:'[@inventory_id@]' type:'category' limit:'1' %]
    [%param *body%]
        <a href="[%url type:'cms'%][%param id%][@content_id@][%/param%][%/url%]">[@content_name@]</a>
    [%/param%]
[%/content_path%]

Parameters

Param Options Description
id:'' String The ID number of the product (not the SKU) to target and load the content path from in the case of inventory
content_id:'' String The ID to target and load the content path from in the case of content pages
type:'' String A comma-separated list of content_type_code. You can get the type from the Code column on Settings & tools > All settings & tools > Control Panel > Content Types Manager
show_path:'' 'y' Returns the paths to the content type via [@content_fullpath@]. Required when using content_id param. Can't be used with the id param
depth:'' Integer Restrict the content type results to a certain level. For example, for the category path Electronics > Cameras > DSRL, the depth for DSLR is 3
sortby:'' content_name, content_fullpath, content_external_ref1, content_external_ref2, content_external_ref3, content_id, content_label1, content_label2, content_label2, content_level, content_type_code, content_type_name, content_ref, parent_content_id The sort option for the content page results
*header HTML & b@se tags Renders a single usable space above the body
*body HTML & b@se tags Runs an array for each option in the tag
*footer HTML & b@se tags Renders a single usable space below the body
*ifempty HTML & b@se tags If the content_path tag produces no results, this block is printed in place of the header, body & footer

Data Tags (body)

Name Content Field Example Description
[@content_description1@] Page Content ^ We opened our first store in 1986. Main page content
[@content_description2@] Description 2 ^ Moved to Brisbane in 2014 Second description field
[@content_description3@] Description 3 ^ Now located in South Brisbane Third description field
[@content_external_ref1@] External Ref 1 35 Used by 3rd party systems and for internal reference purposes
[@content_external_ref2@] External Ref 2 about_us Used by 3rd party systems and for internal reference purposes
[@content_external_ref3@] External Ref 3 form Used by 3rd party systems and for internal reference purposes
[@content_fullpath@] Parent Content Help and Information About Us Full path to the page. In this example Help and Information is the parent of About Us
[@content_id@] 94 ID number of the content page
[@content_label1@] Label 1 ^ red Label or tag (up to 50 characters)
[@content_label2@] Label 2 ^ green Label or tag (up to 50 characters)
[@content_label3@] Label 3 ^ blue Label or tag (up to 50 characters)
[@content_level@] 1 The level where the selected page sits
[@content_name@] Name About Us Name of the content page
[@content_ref@] Link ID ^ about_us String that can be used as a reference for the content page instead of the content ID
[@content_short_description1@] Short Description 1 ^ Hard drive specialists First short description field (up to 255 characters)
[@content_short_description2@] Short Description 2 ^ Repairs and data recovery Second short description field (up to 255 characters)
[@content_short_description3@] Short Description 3 ^ Hard drive sales Third short description field (up to 255 characters)
[@content_type_code@] Unique Code page Unique code of identifier for this content type
[@content_type_name@] Type of Content Web Page Name of content type
[@parent_content_id@] Parent Content 0 The parent content ID of the selected ID. Set to 0 is no parent content selected

^ Content field name can be changed by going to Settings & tools > All settings & tools > Control Panel > Content Types Manager in the control panel.


Was this article useful?

Be notified when this page is updated. Optional.