- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.core.php
r706 r1153 39 39 public $rest; ///< <b>dcRestServer</b> dcRestServer object 40 40 public $log; ///< <b>dcLog</b> dcLog object 41 public $tpl; ///< <b>Twig_Environment</b> Twig_Environment object 41 42 42 43 private $versions = null; … … 95 96 $this->addFormater('xhtml', create_function('$s','return $s;')); 96 97 $this->addFormater('wiki', array($this,'wikiTransform')); 98 $this->loadTemplateEnvironment(); 97 99 } 98 100 … … 118 120 } 119 121 122 /** 123 Create template environment (Twig_Environment instance) 124 125 default-templates path must be added from admin|public/prepend.php with: 126 $core->tpl->getLoader()->addPath('PATH_TO/default-templates'); 127 Selected theme path must be added with: 128 $core->tpl->getLoader()->prependPath('PATH_TO/MY_THEME'); 129 */ 130 public function loadTemplateEnvironment() 131 { 132 $cache_dir = path::real(DC_TPL_CACHE.'/twtpl',false); 133 if (!is_dir($cache_dir)) { 134 try { 135 files::makeDir($cache_dir); 136 } catch (Exception $e) { 137 $cache_dir = false; 138 } 139 } 140 141 $this->tpl = new Twig_Environment( 142 new Twig_Loader_Filesystem(dirname(__FILE__).'/../swf'), 143 array( 144 'auto_reload' => true, 145 'autoescape' => false, 146 'base_template_class' => 'Twig_Template', 147 'cache' => $cache_dir, 148 'charset' => 'UTF-8', 149 'debug' => DC_DEBUG, 150 'optimizations' => -1, 151 'strict_variables' => 0 //DC_DEBUG // Please fix undefined variables! 152 ) 153 ); 154 $this->tpl->addExtension(new dcFormExtension($this)); 155 $this->tpl->addExtension(new dcTabExtension($this)); 156 } 120 157 121 158 /// @name Blog init methods
Note: See TracChangeset
for help on using the changeset viewer.