<@cms_include>

Reference tags for templates

Tag Name

<@cms_include>

Tag Description

Reference other template contents, supporting SSI reference tags.

Tag attributes

AttributeTypeRequiredAvailable valuesDescriptionDefault
fileSTRINGYes Reference template file path (relative to the template directory template/)
ssiBOOLEANNotrue = Yes
false = No
Enable SSI: Yestrue
virtualBOOLEANNotrue = Yes
false = No
Whether to enable the virtual mode. In this mode, blocks cannot inherit the variables from the current page. Necessary variables must be passed as parameters.false
cacheBOOLEANNotrue = Yes
false = No
Enable caching or nottrue

Usage Examples

Note: The templates referenced by the include tag generate cache entries by default, with a caching period of 1 hour. If you need to force an update, you can clear the corresponding template caches through the backend template management interface, or you can set the cache attribute of the include tag to false to disable the caching mechanism. However, this approach will have an impact on the efficiency of static rendering, depending on the complexity of the templates.

Page headers and footers

<!-- header.template.html is an independent template for common header content. -->
<@cms_include file="header.template.html"></@cms_include>

Example 2: Passing dynamic parameters to templates

There are two ways to pass dynamic parameters:

  1. Use non-SSI mode. You can turn off the default SSI switch in site extensions, or set the ssi attribute of the tag to false.
<@cms_include file="header.template.html?a=xx&b=yy" ssi="false"></@cms_include>

In the header.template.html template, the request parameters can be obtained in the following way:

<div>
  Request parameter a: ${Request.a}
  Request parameter b: ${Request.b}
</div>
  1. Use the virtual mode.

Since this mode uses a template that is parsed in real-time during page rendering, the template cannot access the context data of the parent template. It can only access the parameters passed to it.

<@cms_include file="header.template.html?a=xx&b=yy" virtual="true"></@cms_include>

On this page