Changeset 1145
- Timestamp:
- 10/31/08 00:34:05 (2 months ago)
- Files:
-
- trunk/build/manifests/jtpl-standalone-tests.mn (modified) (1 diff)
- trunk/lib/jelix/tpl/jTpl.class.php (modified) (4 diffs)
- trunk/lib/jelix/tpl/jTplCompiler.class.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/tests/exemple.php (modified) (1 diff)
- trunk/lib/jelix/tpl/tests/foo (added)
- trunk/lib/jelix/tpl/tests/foo/test.tpl (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/manifests/jtpl-standalone-tests.mn
r1144 r1145 105 105 expressions_parsing.php 106 106 107 sd lib/jelix/tpl/tests/foo/ 108 dd tests/foo/ 109 test.tpl 110 107 111 sd lib/diff 108 112 dd tests/diff trunk/lib/jelix/tpl/jTpl.class.php
r1143 r1145 232 232 $fct = $fctname.md5($sel->module.'_'.$sel->resource.'_'.$sel->outputType.($trusted?'_t':'')); 233 233 #else 234 $this->_templateName = $tpl; 234 235 $tpl = jTplConfig::$templatePath . $tpl; 235 $this->_templateName = basename($tpl);236 236 if ($outputtype=='') 237 237 $outputtype = 'html'; 238 238 239 $cachefile = jTplConfig::$cachePath. $outputtype.($trusted?'_t':'').'_'.$this->_templateName;239 $cachefile = jTplConfig::$cachePath.dirname($this->_templateName).'/'.$outputtype.($trusted?'_t':'').'_'.basename($tpl); 240 240 241 241 $mustCompile = jTplConfig::$compilationForce || !file_exists($cachefile); … … 250 250 251 251 $compiler = new jTplCompiler(); 252 $compiler->compile($t pl,$outputtype, $trusted, $this->userModifiers, $this->userFunctions);252 $compiler->compile($this->_templateName,$tpl,$outputtype, $trusted, $this->userModifiers, $this->userFunctions); 253 253 } 254 254 require_once($cachefile); … … 278 278 $this->_templateName = $sel->toString(); 279 279 #else 280 $this->_templateName = $tpl; 280 281 $tpl = jTplConfig::$templatePath . $tpl; 281 $this->_templateName = basename($tpl); 282 $cachefile = jTplConfig::$cachePath.$outputtype.($trusted?'_t':'').'_'.$this->_templateName; 282 $cachefile = jTplConfig::$cachePath.dirname($this->_templateName).'/'.$outputtype.($trusted?'_t':'').'_'.basename($tpl); 283 283 284 284 $mustCompile = jTplConfig::$compilationForce || !file_exists($cachefile); … … 292 292 include_once(JTPL_PATH . 'jTplCompiler.class.php'); 293 293 $compiler = new jTplCompiler(); 294 $compiler->compile($t pl, $outputtype, $trusted, $this->userModifiers, $this->userFunctions);294 $compiler->compile($this->_templateName, $tpl, $outputtype, $trusted, $this->userModifiers, $this->userFunctions); 295 295 } 296 296 require_once($cachefile); trunk/lib/jelix/tpl/jTplCompiler.class.php
r1143 r1145 100 100 * @return boolean true if ok 101 101 */ 102 public function compile($tpl File, $outputtype, $trusted, $userModifiers = array(), $userFunctions = array()){102 public function compile($tplName, $tplFile, $outputtype, $trusted, $userModifiers = array(), $userFunctions = array()){ 103 103 $this->_sourceFile = $tplFile; 104 104 $this->outputType = $outputtype; 105 $cachefile = jTplConfig::$cachePath . $this->outputType.($trusted?'_t':'').'_'. basename($tplFile);105 $cachefile = jTplConfig::$cachePath .dirname($tplName).'/'.$this->outputType.($trusted?'_t':'').'_'. basename($tplName); 106 106 $this->trusted = $trusted; 107 107 $this->_modifier = array_merge($this->_modifier, $userModifiers); … … 152 152 153 153 #if JTPL_STANDALONE 154 $_dirname = dirname($cachefile); 155 if (!@is_writable($_dirname)) { 156 // cache_dir not writable, see if it exists 157 if (!@is_dir($_dirname)) { 158 throw new Exception (sprintf($this->_locales['file.directory.notexists'], $_dirname)); 159 } 154 155 $_dirname = jTplConfig::$cachePath.dirname($tplName).'/'; 156 echo $tplFile.'<br>'.$_dirname.'<br>'.$cachefile; 157 if (!is_dir($_dirname)) { 158 umask(0000); 159 mkdir($_dirname, 0777, true); 160 } else if (!@is_writable($_dirname)) { 160 161 throw new Exception (sprintf($this->_locales['file.directory.notwritable'], $cachefile, $_dirname)); 161 162 } trunk/lib/jelix/tpl/tests/exemple.php
r1144 r1145 12 12 $tpl->display('test.tpl'); 13 13 14 $tpl = new jTpl(); 15 $tpl->assign('titre', 'This is an other test !'); 16 $tpl->display('foo/test.tpl'); 14 17 18 19
