Переход с MODX на October CMS. Часть 2-я

В отличие от MODX, теги в October можно использовать исключительно в layouts, pages и partials. В контенте статических страниц (Static Pages) они не работают.
Ниже приведены таблицы соответствия тегов MODX и тегов October CMS.

Всем, кто сейчас зачем-то учит Fenom для MODX, настоятельно рекомендую переходить на October CMS и Twig.

Tag Format for Content Elements and Content Tags

Content ElementsMODX RevolutionOctober CMS
Templatesno tag representation 
Resource Fields[[*field]]{{ variable }}
Template Variables[[*templatevar]]{variable name="tagline" label="Tagline" tab="Header" type="text"}{/variable}
Chunks[[$chunk]]{% partial 'footer' %}
 [[$Hello?name=`George`]]{% partial 'Hello' name='George' %}
Snippets[[snippet]]
[[pdoResources?
&limit=`5`
&tpl=`ListRowTpl`
]]
{% component 'blogPosts' %}
{% component "blogPosts" postsPerPage="5" %}
Pluginsno tag representation 
Modulesdoes not exist in Revolution, use CMPs 
Content Tags  
Placeholders[[+placeholder]]{% placeholder name %}
Links[[~link]]{{ 'about'|page }}
{{ 'about'|staticPage }}
{{ this.page.url|app }}
System Settings[[++system_setting]]{{ this.theme.theme_setting }}
Language[[%language_string_key]]{{ activeLocale }}
Comment (see note below)[[-this is a comment]]{# this is a comment #}
MODX TagOctober CMSExample Usage
[[*id]]{{ this.page.id }}
{{ this.page.url }}
{{ post.url }}
<a href="{{ this.page.id|app}}">Bookmark this page!</a>
[[*pagetitle]]{{ this.page.title }}<title>{{ this.page.title }}</title>
[[*longtitle]]{{ this.page.title }}
{{ this.page.meta_title }}
{{ this.page.description }}
<h1>{{ this.page.meta_title }}</h1>
[[*alias]]{{ this.page.id }}
{{ this.layout.id }}
{{ this.theme.id }}
{{ this.param.slug }}
<body class="page-{{ this.page.id }}">
[[*description]]{{ this.page.meta_description }}
{{ this.layout.description }}
{{ this.theme.config.description }}
<meta name="description" content="{{ this.page.meta_description }}">
[[*introtext]]{{ this.page.description }}<p>{{ this.page.description }}</p>
[[*parent]]{{ this.page.parent }}

 

{% set parent = page.getParent() %}
{{ parent }}

 
[[*menutitle]]{{ item.title }} 
[[*content]]{% page %}
{% content %}
<body>{% page %}</body>
{% content "location.htm" city="Vancouver" country="Canada" %}
MODX TagOctober TagOctober Example Usage
[[++site_url]]{{ this.page.url|app }}<link rel="canonical" href="{{ this.page.url|app }}">
[[++site_name]]{{ this.theme.site_name }}<title>{{ this.page.title }} — {{ this.theme.site_name }}</title>
[[++site_start]]{{ '/'|app }}<a id="logo" href="{{ '/'|app }}">Home</a>
[[++assets_url]]css/style.css{{ 'assets/css/style.css'|theme }} <link href="{{ 'assets/css/style.css'|theme }}" rel="stylesheet">
[[$chunk]]{% partial 'path/chunk' %}{% partial 'site/footer' %}
[[~link]]{{ 'Home'|page }}<a id="logo" href="{{ 'Home'|page }}">Home</a>
[[%translated_message]]{{ 'Welcome to our website!'|_ }} <strong>{{ 'Welcome to our website!'|_ }}</strong>

All Tags

TagOctober CMSExample Usage
[[*alias]]{{ this.page.id }}
{{ this.page.url }}
<a href="{{ this.page.url|app }}">Click Here!</a>
[[*cacheable]]Cacheable 
[[*class_key]]Class Key of the Resource, e.g. modDocument 
[[*content]]Resource Content{% page %}
[[*content_type]]Content Type 
[[*createdon]]Created On date, e.g. 2011-04-14 20:40:50, often used in conjunction with the strtotime output filter{{ record.created_at|date('c') }}
[[*createdby]]Created By User ID Number 
[[*deleted]]Deleted 
[[*deletedby]]Deleted By User ID Number 
[[*deletedon]]Date of Deletions 
[[*description]]Description{{ this.page.meta_description }}
[[*editedon]]Edited On date, e.g. 2011-04-18 09:06:08{{ record.updated_at|date('c') }}
[[*editedby]]Edited By User ID number 
[[*hidemenu]]{{ this.page.hidden }}{% if this.page.hidden %}
<p>Note to other admins: We are currently working on this page.</p>
{% endif %}
[[*id]]Resource IDUsed frequently to generate links to this page.
[[*introtext]]Summary{{ this.page.description }}
{{ post.summary|raw }}
[[*isfolder]]Container 
[[*link_attributes]]Link attributes; these are inserted automatically when you use the [[~123]] syntax 
[[*longtitle]]Long Title{{ this.page.meta_title }}
[[*menuindex]]Menu Index 
[[*menutitle]]Menu Title —
[[*pagetitle]]Page Title{{ this.page.title }}
{{ item.title }}
{{ post.title }}
[[*parent]]Parent Resource{{ this.page.parent }}
{{ page.getParent().url }}
[[*pub_date]] 
[[*published]]Published 
[[*publishedby]]Published By User ID Number 
[[*publishedon]]Published On 
[[*richtext]]Rich Text
[[*searchable]]Searchable 
[[*template]]{{ this.page.layout }}
{{ this.layout.id }}
 
   
[[*unpub_date]][[*unpub_date:strtotime:date=`%a %b %e, %Y`]] See Date Formats.
[[*uri_override]]Freeze URI 
[[*uri]]URI{{ this.page.url }}
{{ post.url }}

Input and Output Filters (Output Modifiers)

MODX TagOctober CMS
[[+description:limit=`100`]]{{ str_limit( this.page.description, 100 ) }}
{{ html_limit('<p>Post content...</p>', 100) }}
[[+description:ellipsis=`100`]]{{ str_words( this.page.description, 20 ) }}
[[+code:strip_tags]]{{ html_strip('<strong>Hello world</strong>') }}
[[+pagetitle:replace=`Mr.==Mrs.`]]{{ this.page.title|replace({'Mr.': 'Mrs.'}) }}
[[+pagetitle:uppercase]]{{ this.page.title|upper }}
[[+description:Jevix]]{{ html_clean('<script>window.location = "http://google.com"</script>') }}
[[+email:escape]]{% verbatim %}<p>Hello, {{ name }}</p>{% endverbatim %}
[[+placeholder:is=`0`:then=`
Yes
`:else=`
No
`]]
{{ isAjax ? 'Yes' : 'No' }}

 

{% if stormCloudComing %}
Stay inside
{% else %}
Go outside and play
{% endif %}

[[*image:phpthumbof=`w=250&h=100`]]{{ '/path/to/image.jpg' | resize(250, 100) }}
[[*image:default=`image.png`]]{{ image|default('image.png') }}

Продолжение: Переход с MODX на October CMS. Часть третья.

Комментарии читателей

  1. Дмитрий 02.01.2018
    • zooks 02.01.2018
  2. Cheizer 14.01.2018
    • zooks 15.01.2018
      • Igor 23.03.2018
        • Павел 28.03.2018
  3. Тоха 24.11.2018
  4. Роман 15.07.2020

Добавить комментарий