Changeset 1056:b67f949a98f8 for inc/core
- Timestamp:
- 12/09/12 03:12:34 (13 years ago)
- Branch:
- twig
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.core.php
r706 r1056 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 99 $this->loadTemplateEnvironment(); 97 100 } 98 101 … … 118 121 } 119 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 = dirname(DC_TPL_CACHE.'/twtpl'); 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' => 'html', 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 } 120 158 121 159 /// @name Blog init methods
Note: See TracChangeset
for help on using the changeset viewer.