Templating - Latte

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

  1. __("Translate this", $catstring)
  2. Add word or phrase as a new line in /site/translations.php
  3. Add translations in admin (Admin->Setup->Languages->French->Translate translations.php)

This page was last edited on 2025-05-28 12:28

Powered by Wiki|Docs

This page was last edited on 2025-05-28 12:28

Safetycat Inc.
don't copy it

Powered by Wiki|Docs