| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?PHP 2 /** 3 * patTemplate function that enables you to insert any 4 * template, that has been loaded previously into the 5 * current template. 6 * 7 * You may pass any variables to the template. 8 * 9 * $Id: Call.php 10381 2008-06-01 03:35:53Z pasamio $ 10 * 11 * @package patTemplate 12 * @subpackage Functions 13 * @author Stephan Schmidt <schst@php.net> 14 */ 15 16 // Check to ensure this file is within the rest of the framework 17 defined('JPATH_BASE') or die(); 18 19 /** 20 * template does not exist 21 */ 22 define( 'PATTEMPLATE_FUNCTION_CALL_ERROR_NO_TEMPLATE', 'patTemplate::Function::Call::NT' ); 23 24 /** 25 * patTemplate function that enables you to insert any 26 * template, that has been loaded previously into the 27 * current template. 28 * 29 * You may pass any variables to the template. 30 * 31 * $Id: Call.php 10381 2008-06-01 03:35:53Z pasamio $ 32 * 33 * @package patTemplate 34 * @subpackage Functions 35 * @author Stephan Schmidt <schst@php.net> 36 */ 37 class patTemplate_Function_Call extends patTemplate_Function 38 { 39 /** 40 * name of the function 41 * @access private 42 * @var string 43 */ 44 var $_name = 'Call'; 45 46 /** 47 * reference to the patTemplate object that instantiated the module 48 * 49 * @access protected 50 * @var object 51 */ 52 var $_tmpl; 53 54 /** 55 * set a reference to the patTemplate object that instantiated the reader 56 * 57 * @access public 58 * @param object patTemplate object 59 */ 60 function setTemplateReference( &$tmpl ) 61 { 62 $this->_tmpl = &$tmpl; 63 } 64 65 /** 66 * call the function 67 * 68 * @access public 69 * @param array parameters of the function (= attributes of the tag) 70 * @param string content of the tag 71 * @return string content to insert into the template 72 */ 73 function call( $params, $content ) 74 { 75 // get the name of the template to use 76 if (isset($params['template'])) { 77 $tmpl = $params['template']; 78 unset( $params['template'] ); 79 } elseif (isset($params['_originalTag'])) { 80 $tmpl = $params['_originalTag']; 81 unset( $params['_originalTag'] ); 82 } else { 83 return patErrorManager::raiseError( PATTEMPLATE_FUNCTION_CALL_ERROR_NO_TEMPLATE, 'No template for Call function specified.' ); 84 } 85 86 if (!$this->_tmpl->exists( $tmpl )) { 87 88 $tmpl = strtolower($tmpl); 89 90 // try some autoloading magic 91 $componentLocation = $this->_tmpl->getOption('componentFolder'); 92 $componentExtension = $this->_tmpl->getOption('componentExtension'); 93 $filename = $componentLocation . '/' . $tmpl . '.' . $componentExtension; 94 $this->_tmpl->readTemplatesFromInput($filename); 95 96 // still does not exist 97 if( !$this->_tmpl->exists( $tmpl ) ) { 98 return patErrorManager::raiseError( PATTEMPLATE_FUNCTION_CALL_ERROR_NO_TEMPLATE, 'Template '.$tmpl.' does not exist' ); 99 } 100 } 101 102 /** 103 * clear template and all of its dependencies 104 */ 105 $this->_tmpl->clearTemplate( $tmpl, true ); 106 107 /** 108 * add variables 109 */ 110 $this->_tmpl->addVars( $tmpl, $params ); 111 $this->_tmpl->addVar( $tmpl, 'CONTENT', $content ); 112 113 /** 114 * get content 115 */ 116 return $this->_tmpl->getParsedTemplate( $tmpl ); 117 } 118 } 119 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |