october CMS 模板

变量:

{{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并返回该对象Cms\Classes\Layout
//
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 %}

转载于:https://www.cnblogs.com/jdwang-admin/p/7366814.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值