Exemple #1
0
function precompileTemplateWithLanguage($sTemplate, $sLanguage)
{
    global $opt, $translate;
    // cheating a little bit
    $opt['template']['locale'] = $sLanguage;
    setlocale(LC_MONETARY, $opt['locale'][$opt['template']['locale']]['locales']);
    setlocale(LC_TIME, $opt['locale'][$opt['template']['locale']]['locales']);
    if (defined('LC_MESSAGES')) {
        setlocale(LC_MESSAGES, $opt['locale'][$opt['template']['locale']]['locales']);
    }
    if ($translate->t('INTERNAL_LANG', 'all', 'OcSmarty.class.php', '') != $sLanguage) {
        die("setlocale() failed to set language to " . $sLanguage . ". Is the translation of INTERNAL_LANG correct?\n");
    }
    $preTemplate = new OcSmarty();
    $preTemplate->name = $sTemplate;
    $preTemplate->compile($sTemplate . '.tpl', $preTemplate->get_compile_id());
}
 /**
  * @param \OcSmarty $template
  */
 public function prepare($template)
 {
     $template->assign(self::tpl_note_id, $this->noteId);
     $template->assign(self::tpl_cache_id, $this->cacheId);
     $template->assign(self::tpl_note, $this->getNote());
     $template->assign(self::tpl_incl_coord, $this->coordinate->hasCoordinate());
     $this->coordinate->prepare($template);
 }