Source for file with.php
Documentation is available at with.php
* Moves the scope down into the provided variable, allowing you to use shorter
* variable names if you repeatedly access values into a single array
* The with block won't display anything at all if the provided scope is empty,
* so in effect it acts as {if $var}*content*{/if}
* * var : the variable name to move into
* instead of the following :
* {if $long.boring.prefix}
* {$long.boring.prefix.val} - {$long.boring.prefix.secondVal} - {$long.boring.prefix.thirdVal}
* {with $long.boring.prefix}
* {$val} - {$secondVal} - {$thirdVal}
* 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($var)
public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)
public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content)
$rparams =
$compiler->getRealParams($params);
$cparams =
$compiler->getCompiledParams($params);
$compiler->setScope($rparams['var']);
$pre =
Dwoo_Compiler::PHP_OPEN.
'if ('.
$cparams['var'].
')'.
"\n{\n".
'$_with'.
(self::$cnt).
' = $this->setScope("'.
$rparams['var'].
'");'.
'$this->setScope($_with'.
(self::$cnt++
).
', true);'.
if (isset
($params['hasElse'])) {
$post .=
$params['hasElse'];
return $pre .
$content .
$post;
Documentation generated on Sun, 07 Feb 2010 17:54:00 +0000 by phpDocumentor 1.4.0