<@cms_include>
Reference other template contents, supporting SSI reference tags.
| Attribute | Type | Required | Available values | Description | Default |
|---|---|---|---|---|---|
| file | STRING | Yes | Reference template file path (relative to the template directory template/) | ||
| ssi | BOOLEAN | No | true = Yes false = No | Enable SSI: Yes | true |
| virtual | BOOLEAN | No | true = 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 |
| cache | BOOLEAN | No | true = Yes false = No | Enable caching or not | true |
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.
<!-- header.template.html is an independent template for common header content. -->
<@cms_include file="header.template.html"></@cms_include>
There are two ways to pass dynamic parameters:
<@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>
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>