变量:
{{variable}} {{isAjax?'Yes':'No'}} {{'Your name:' ~ name}}
标签:
{%tag%}
{%if stormCloudComing%}
Stay inside
{else %}
Gooutside and play
{%endif%}
{%set activePage='blog'%}
过滤器:
{{‘string’|filter}}
{{price |currency('USD')}}
{{'October Glory'|upper|replace({'October':'Morning'})}}
功能:
{{function()}}
{{dump(variable)}}
this.page:
//布局: {{this.page.layout}} //id:文件名称和文件夹名称转换为css友好标识符 <body class="page-{{this.page.id}}"> //标题 <h1>{{this.page.title}}</h1> //描述 <p>{{ this.page.description }}</p> //meta_title <title>{{ this.page.meta_title }}</title> //meta_description <meta name="description" content="{{ this.page.meta_description }}"> //隐:隐藏的页面只能由登录的后端用户访问。 {% if this.page.hidden %} <p>Note to other admins: We are currently working on this page.</p> {% endif %}
this.layout:
//属性:您可以通过访问当前的布局对象,this.layout并返回该对象CmsClassesLayout
//ID: <body class="layout-{{ this.layout.id }}"> //描述 <meta name="description" content="{{ this.layout.description }}">
this.theme:
//属性 :this.theme将提供直接访问表单字段值,由任何主题定制定义。它本身也具有以下特性
//ID<body class="theme-{{ this.theme.id }}">
//配置
<meta name="description" content="{{ this.theme.config.description }}">
this.param:
//您可以通过this.param它访问当前的URL参数,并返回一个PHP数组 //访问页面参数 //如何访问tab页面中的URL参数。 url = "/account/:tab" == {% if this.param.tab == 'details' %} <p>Here are all your details</p> {% elseif this.param.tab == 'history' %} <p>You are viewing a blast from the past</p> {% endif %} //如果参数名称也是一个变量,那么可以使用数组语法 url = "/account/:post_id" == {% set name = 'post_id' %} <p>The post ID is: {{ this.param[name] }}</p>
this.environment
//您可以通过访问当前环境对象,this.environment并返回引用当前环境配置的字符串 //如果网站在测试环境中运行,以下示例将显示横幅: {% if this.environment == 'test' %} <div class="banner">Test Environment</div> {% endif %}
{%partial%}
{% partial "footer" %}
{% partial "sidebar/menu" %}
{% set tabName = "profile" %}
{% partial tabName %}
% partial "blog-posts" posts=posts %}
{% partial "location" city="Vancouver" country="Canada" %}
<p>Country: {{ country }}, city: {{ city }}.</p>
{%content%}
{% content "contacts.htm" %}
{% content "sidebar/content.htm" %}
{% content "readme.txt" %}
{% content "changelog.md" %}
{% put sidebar %}
{% content 'sidebar-content.htm' %}
{% endput %}
{% content "welcome.htm" name=user.name %}
{% content "location.htm" city="Vancouver" country="Canada" %}
<p>Country: {country}, city: {city}.</p>
{% content "welcome.htm" likes=[
{name:'Dogs'},
{name:'Fishing'},
{name:'Golf'}
] %}
<ul>
{likes}
<li>{name}</li>
{/likes}
</ul>
{%占位符%}
{% placeholder name %}
{% put name %}
<p>Place this text in the name placeholder</p>
{% endput %}
{% placeholder sidebar default %}
<p><a href="/contacts">Contact us</a></p>
{% endplaceholder %}
{% put sidebar %}
<p><a href="/services">Services</a></p>
{% default %}
{% endput %}
//检测占位符是否存在
{% if placeholder('sidemenu') %}
<!-- Markup for a page with a sidebar -->
<div class="row">
<div class="col-md-3">
{% placeholder sidemenu %}
</div>
<div class="col-md-9">
{% page %}
</div>
</div>
{% else %}
<!-- Markup for a page without a sidebar -->
{% page %}
{% endif %}
//自定义属性
{% placeholder ordering title="Ordering information" type="text" %}
{% placeholder ordering default title="Ordering information" type="text" %}
There is no ordering information for this product.
{% endplaceholder %}