Skip to content

Fragments#


Fragments are a specialized type of page that can be directly referenced within page templates using the syntax. This feature is designed to centralize and streamline repetitive core logic across multiple templates, making maintenance and updates more efficient. For instance, you can define common elements like global headers and footers within a fragment, and then simply reference these fragments across relevant pages within the runtime interface.

Fragments operate at a level above Content Sections, offering the ability to assign items and execute template code. However, they don’t function as fully independent runtime pages—they sit between Content Sections and full pages in terms of capabilities. Fragments are versioned across branches and support item assignment, but they cannot be directly accessed at runtime and do not support caching or URI generation, similar to admin and layout pages.

A ‘Fragments’ tab is located in the User Interface screen, enabling the creation and modification of fragments directly within the admin. Fragments can be copied, but unlike full pages and layouts, they cannot be copied across other page types, maintaining their unique use case within the system

Fragment Items#

Only items that implement the component_frag feature can be assigned to fragments. This new feature requires the ComponentModule_Initialize_Fragment API function to exist as this custom initialization function will be called when initializing fragments, prior to rendering. Modules associated with these items are forbidden from raising an UI exceptions during their initialization and/or UI exceptions will not be handled. For more information about this see the Fragments section here

User Interface: Fragments Tab#

A “Fragments” tab within User Interface > Templates tab has been added with three default fragments; Global Header (global_header), Global Footer (global_footer), and Product List Additional Data (product_list_additional_data).

Note

Copying a fragment is available however, copying a page/layout to a fragment and vice versa is not supported.