Changeset 1128:9e868a6c21c3 for inc/core/class.dc.core.php
- Timestamp:
- 03/25/13 04:31:18 (12 years ago)
- Branch:
- twig
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.core.php
r1099 r1128 97 97 $this->addFormater('wiki', array($this,'wikiTransform')); 98 98 99 $this-> loadTemplateEnvironment();99 $this->tpl = new dcTemplate(DC_TPL_CACHE,'$core->tpl',$this); 100 100 } 101 101 … … 119 119 120 120 return new $c($this); 121 }122 123 /**124 Create template environment (Twig_Environment instance)125 126 default-templates path must be added from admin|public/prepend.php with:127 $core->tpl->getLoader()->addPath('PATH_TO/default-templates');128 Selected theme path must be added with:129 $core->tpl->getLoader()->prependPath('PATH_TO/MY_THEME');130 */131 protected function loadTemplateEnvironment()132 {133 # If cache dir is writable, use it.134 $cache_dir = path::real(DC_TPL_CACHE.'/twtpl',false);135 if (!is_dir($cache_dir)) {136 try {137 files::makeDir($cache_dir);138 } catch (Exception $e) {139 $cache_dir = false;140 }141 }142 143 $this->tpl = new Twig_Environment(144 new Twig_Loader_Filesystem(dirname(__FILE__).'/../swf'),145 array(146 'auto_reload' => true,147 'autoescape' => false,148 'base_template_class' => 'Twig_Template',149 'cache' => $cache_dir,150 'charset' => 'UTF-8',151 'debug' => DC_DEBUG,152 'optimizations' => -1,153 'strict_variables' => 0 //DC_DEBUG // Please fix undefined variables!154 )155 );156 $this->tpl->addExtension(new dcFormExtension($this));157 $this->tpl->addExtension(new dcTabExtension($this));158 121 } 159 122
Note: See TracChangeset
for help on using the changeset viewer.