october CMS 模板

Posted wjd0215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 %}

以上是关于october CMS 模板的主要内容,如果未能解决你的问题,请参考以下文章

在october cms中使用geolocation插件

Laravel项目October安装

october页面

九十五:CMS系统之cms后台模板渲染

VSCode自定义代码片段——.vue文件的模板

VSCode自定义代码片段1——vue主模板