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