Changeset 430
- Timestamp:
- 04/30/07 16:16:17 (2 years ago)
- Files:
-
- trunk/lib/jelix/core/jSelector.class.php (modified) (1 diff)
- trunk/lib/jelix/tpl/jTpl.class.php (modified) (3 diffs)
- trunk/lib/jelix/tpl/jTplCompiler.class.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix/core/jSelector.class.php
r427 r430 533 533 protected $_suffix = '.tpl'; 534 534 protected $_where; 535 536 function __construct($sel){ 535 public $outputType=''; 536 537 /** 538 * @param string $sel the template selector 539 * @param string $outputtype the type of output (html, text..) By default, it take the response type 540 */ 541 function __construct($sel, $outputtype=''){ 542 if($outputtype == '') 543 $this->outputType = $GLOBALS['gJCoord']->response->getFormatType(); 544 else 545 $this->outputType = $outputtype; 546 537 547 $this->_compiler='jTplCompiler'; 538 548 $this->_compilerPath=JELIX_LIB_TPL_PATH.'jTplCompiler.class.php'; trunk/lib/jelix/tpl/jTpl.class.php
r411 r430 162 162 * @param string $fctname the internal function name (meta or content) 163 163 */ 164 protected function getTemplate($tpl,$fctname ){164 protected function getTemplate($tpl,$fctname, $outputtype=''){ 165 165 #ifnot JTPL_STANDALONE 166 $sel = new jSelectorTpl($tpl );166 $sel = new jSelectorTpl($tpl,$outputtype); 167 167 jIncluder::inc($sel); 168 168 $fct = $fctname.md5($sel->module.'_'.$sel->resource); … … 183 183 184 184 $compiler = new jTplCompiler(); 185 $compiler->compile($tpl );185 $compiler->compile($tpl,$outputtype); 186 186 } 187 187 require_once($cachefile); … … 194 194 * return the generated content from the given template 195 195 * @param string $tpl template selector 196 * @param string $outputtype 196 197 * @return string the generated content 197 198 */ 198 public function fetch ($tpl ){199 public function fetch ($tpl, $outputtype=''){ 199 200 ob_start (); 200 201 try{ 201 $this->getTemplate($tpl,'template_' );202 $this->getTemplate($tpl,'template_', $outputtype); 202 203 $content = ob_get_clean(); 203 204 }catch(Exception $e){ trunk/lib/jelix/tpl/jTplCompiler.class.php
r415 r430 62 62 private $_sourceFile; 63 63 private $_currentTag; 64 private $_outputType; 64 65 65 66 /** … … 87 88 * @return boolean true if ok 88 89 */ 89 public function compile($tplFile ){90 public function compile($tplFile, $outputtype){ 90 91 $this->_sourceFile = $tplFile; 91 92 $cachefile = JTPL_CACHE_PATH . basename($tplFile); 92 93 $this->_outputType = ($outputtype==''?'html':$outputtype); 93 94 #else 94 95 /** … … 102 103 $this->_sourceFile = $selector->getPath(); 103 104 $cachefile = $selector->getCompiledFilePath(); 104 105 $this->_outputType = $selector->outputType; 105 106 jContext::push($selector->module); 106 107 #endif … … 502 503 */ 503 504 protected function _getPlugin($type, $name){ 504 #if JTPL_STANDALONE505 $treq = 'html';506 #else507 global $gJCoord, $gJConfig;508 $treq = $gJCoord->response->getFormatType();509 #endif510 505 $foundPath=''; 511 506 512 507 #if JTPL_STANDALONE 513 if(isset($GLOBALS['jTplConfig']['tplpluginsPathList'][$treq])){ 514 foreach($GLOBALS['jTplConfig']['tplpluginsPathList'][$treq] as $path){ 515 #else 516 if(isset($gJConfig->{'_tplpluginsPathList_'.$treq})){ 517 foreach($gJConfig->{'_tplpluginsPathList_'.$treq} as $path){ 508 if(isset($GLOBALS['jTplConfig']['tplpluginsPathList'][$this->_outputType])){ 509 foreach($GLOBALS['jTplConfig']['tplpluginsPathList'][$this->_outputType] as $path){ 510 #else 511 global $gJConfig; 512 if(isset($gJConfig->{'_tplpluginsPathList_'.$this->_outputType})){ 513 foreach($gJConfig->{'_tplpluginsPathList_'.$this->_outputType} as $path){ 518 514 #endif 519 515 $foundPath=$path.$type.'.'.$name.'.php';
