Source for file template.php
Documentation is available at template.php
* Defines a sub-template that can then be called (even recursively) with the defined arguments
* * rest : list of arguments and optional default values
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the use of this software.
* @author Jordi Boggiano <j.boggiano@seld.be>
* @copyright Copyright (c) 2008, Jordi Boggiano
* @license http://dwoo.org/LICENSE Modified BSD License
public function init($name, array $rest =
array())
public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)
$params =
$compiler->getCompiledParams($params);
if (!isset
($params['*']))
foreach ($params['*'] as $param=>
$defValue) {
if (is_numeric($param)) {
$param =
trim($param, '\'"');
$parsedParams[$param] =
$defValue;
$params['name'] =
substr($params['name'], 1, -
1);
$params['*'] =
$parsedParams;
$compiler->addTemplatePlugin($params['name'], $parsedParams, $params['uuid']);
$currentBlock =
& $compiler->getCurrentBlock();
$currentBlock['params'] =
$params;
public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content)
$paramstr =
'Dwoo $dwoo';
$init =
'static $_callCnt = 0;'.
"\n".
'$dwoo->scope[\' '.
$params['uuid'].
'\'.$_callCnt] = array();'.
"\n".
'$_scope = $dwoo->setScope(array(\' '.
$params['uuid'].
'\'.($_callCnt++)));'.
"\n";
$cleanup =
'/* -- template end output */ $dwoo->setScope($_scope, true);';
foreach ($params['*'] as $param=>
$defValue) {
if ($defValue ===
null) {
$paramstr.=
', $'.
$param.
' = '.
$defValue;
$init .=
'$dwoo->scope[\''.
$param.
'\'] = $'.
$param.
";\n";
$init .=
'/* -- template start output */';
$funcName =
'Dwoo_Plugin_'.
$params['name'].
'_'.
$params['uuid'];
$content =
str_replace($search, $replacement, $content);
$body =
'if (!function_exists(\''.
$funcName.
"')) {\nfunction ".
$funcName.
'('.
$paramstr.
') {'.
"\n$init".
Dwoo_Compiler::PHP_CLOSE.
$prepend.
$content.
$append.
$compiler->addTemplatePlugin($params['name'], $params['*'], $params['uuid'], $body);
Documentation generated on Sun, 07 Feb 2010 17:53:59 +0000 by phpDocumentor 1.4.0