• MODX.com

    1,225 downloads

modxTwig

modxTwig is an extra by codenator, first released on 2014-06-16.

Package Description

For using plugin click on Elements tab and open Templates tree. Create new template for example name it index, check 'Is Static' and name indexController.php.

In Template code (html) put this code:

return $modx->twig->render('index.twig');

save your template and click on Resources tab. Click on the Home document and in "Uses Template"

change template on index.

Now you can see your front end just go to Site->View

For pass same variables in template write

$myvar = ['first'=>'Первый','sekond'=>'Второй','last'=>'Последний'];

$modx->twig->addGlobal('text', $myvar);return $modx->twig->render('index.twig');

to call $myvar in index.twig write{{ myvar.first }} and we get output 'Первый'

modx

================================================

$modx->getOption('site_url');{{ modx.Option('site_url') }}$modx->resource->content;{{ modx.resource.content }}

Snippe

t=================================================

min snippet`s call{{ snippet('mysnippet') }}

where Wayfinder snippet`s name and  {'startId':0} params{{ snippet('Wayfinder', {'startId':0}) }} Chunk===============================================

Chunk call{{ chunk('mychunk') }}Call chunk with params{{ chunk('mychunk',{'key':'value'}) }}

Placeholders

================================================

{{ ph('myplaceholder') }}

Configs

================================================

{{ config('site_start') }}with params{{ config('site_start':'default') }}

Link

================================================

{{ link('id') }}with params like {{ link('id',{'cultureKey':'ru'}) }}

Resources fields

=================================================

{{ field({'name':'fulltitle'}) }}

with params

{{ field({'name':'fulltitle','key':'value'} })field work with tv as wel

l=================================================

Add trans tag which work with lexicon entry

{{ trans('key','lang:namespace:topic',{'sport':'basketball'}) }}

where {'sport':'basketball'} placeholder in lexicon normaly call

{{ trans('key','namespace:topic') }}

My mail apoltarjonoks@gmail.com

Link to  my site with same tutorials to came http://codenator.dev-point.org/

Usage/Installation Instructions

Install via Package Management.

Details

Developer(s)
codenator
Released
2014-06-18
First seen
2014-06-16
License
GPLv2
Supported databases
MySQL SQL Server
Minimum MODX Requirement
2.2

modxTwig Releases

Vendor Signature Released on
MODX.com 1.0.0-rc 2014-06-18 (10 years ago)