Templating - Latte
- Syntax https://latte.nette.org/en/syntax
- Tags https://latte.nette.org/en/tags
- Filters https://latte.nette.org/en/filters
Handy tips.
list out an array with comma when needed
{$pages->get('/')->children->each('title') | join(', ')}
Make all pages of certain template active in all languages (can also be done in Admin Actions
$pages->setOutputFormatting(false);
$pag = $pages->find("template='product'");
foreach($pag as $p) {
foreach($languages as $lang) {
if($lang->isDefault()) continue;
$p->set("status$lang", 1);
$p->save();
}
}
To get the options title in current user language use
$type_material->getTitle();
Translations in Templates
To add a translateable word or phrase to the template
__("Translate this", $catstring)- Add word or phrase as a new line in /site/translations.php
- Add translations in admin (Admin->Setup->Languages->French->Translate translations.php)