modxTwig
modxtwig
About
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/
Installation & usage
At a glance
MODX 3 compatibility unknown. Based on our testing and community reports where available.
- Developer codenator
- Latest release June 18, 2014 (12 years ago)
- First seen in SiteDash June 16, 2014 (12 years ago)
- License GPLv2
- MODX support 2.2 – 2.4
- Databases MySQL , SQL Server
| Changelog | |||
|---|---|---|---|
| MODX.com |
1.0.0-rc |
June 18, 2014
12 years ago |
|
|
<p>Initial content</p><p>Added debug mode and caching</p><p>Rename to modxTwig for shorter name</p><p>Added cached snippet</p>
|
|||
|
No matching releases. |
|||