———
|
Table of Contents
Configuration ExamplesSingle template dirWhen having single template dir, set subtemplateDir to false $c = CascadedTemplate::getDefaultConfig(); $c->mainDir = PROJECT_DIR.'/tpl'; $c->subtemplateDir = false; // we only have one template dir $c->setTplPath($c->mainDir, 'tpl'); $c->webPath = '/'; $c->reportUndefinedVariables = false; $c->useModRewrite = true; // equivalent to: //$c->tplRootDir = $c->mainDir; $c->tplRootDir = $c->mainDir; CascadedTemplate::initDefaultHtmlProcessors(false); CascadedTemplate::addDefaultProcessor(new ConstantProcessor()); Multi-teplate dirBecareful with the case in this setup!!! $c->mainDir = PROJECT_DIR.'/tpl/maintpl'; $c->subtemplateDir = PROJECT_DIR.'/tpl/user/template1'; // we only have one template dir $c->setTplPath(PROJECT_DIR.'/tpl', 'tpl'); $c->webPath = '/'; $c->reportUndefinedVariables = false; $c->useModRewrite = true; // equivalent to: //$c->tplRootDir = $c->mainDir; $c->tplRootDir = $c->mainDir; CascadedTemplate::initDefaultHtmlProcessors(false); CascadedTemplate::addDefaultProcessor(new ConstantProcessor()); //Make sure to use different namespace when having multiple templates in a project $cache = new \nsfw\cache\MemCache('project-name:tpl-name-or-id', $memcacheSettings); Multi-Language setup
To initialize multi-language support pass CascadedTemplate::initDefaultHtmlProcessors(true); |