| Attribute Name | Type | Required | Default | Description |
|---|---|---|---|---|
| file | string | Yes | n/a | The name of the template file to include |
| assign | string | No | n/a | The name of the variable that the output of include will be assigned to |
| [var ...] | [var type] | No | n/a | variable to pass local to template |
Include tags are used for including other templates in the current template. Any variables available in the current template are also available within the included template. The include tag must have the attribute "file", which contains the template resource path.
include 標籤的功能是將其他樣版包含到現在的樣版中。在現在樣版中有包 含值的變數都可以被包含進來的樣板使用,include 標籤必須有 "file" 屬性,其值為樣板檔案 的路徑。
You can optionally pass the assign attribute, which will specify a template variable name that the output of include will be assigned to instead of displayed.
你可以使用 assign 屬性指定用 include 包含進來的樣板檔是要給哪個變數名稱,但是使用此一屬性還不會將樣板檔的內容展示出來。
You can also pass variables to included templates as attributes. Any variables explicitly passed to an included template as attributes are only available within the scope of the included file. Attribute variables override current template variables, in the case they are named alike.
你也可以將變數當作參數傳遞給被包含進來的樣版。任何被當作參數傳遞給 被包含進來的樣版的這些變數只有在被包含進來的樣板的檔案間是可獲得的。當變數名字一樣時 ,參數變數會覆蓋樣版變數。
Use the syntax for template resources to include files outside of the $template_dir directory.
使用 template resources 語法將 $template_dir 目錄變數外的檔案包含進來。