Changeset 1153:1e48950b05af for inc/core
- Timestamp:
- 04/02/13 13:15:32 (12 years ago)
- Branch:
- twig
- Parents:
- 1152:fbd922f6ed09 (diff), 1138:11db80678704 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.core.php
r1128 r1153 96 96 $this->addFormater('xhtml', create_function('$s','return $s;')); 97 97 $this->addFormater('wiki', array($this,'wikiTransform')); 98 99 $this->tpl = new dcTemplate(DC_TPL_CACHE,'$core->tpl',$this); 98 $this->loadTemplateEnvironment(); 100 99 } 101 100 … … 119 118 120 119 return new $c($this); 120 } 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)); 121 156 } 122 157
Note: See TracChangeset
for help on using the changeset viewer.