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.
* This file is released under the LGPL
* "GNU Lesser General Public License"
* More information can be found here:
* {@link http://www.gnu.org/copyleft/lesser.html}
* @copyright Copyright (c) 2008, Jordi Boggiano
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
public function init($var)
public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)
$rparams =
$compiler->getRealParams($params);
$cparams =
$compiler->getCompiledParams($params);
$compiler->setScope($rparams['var']);
$params =
& $compiler->getCurrentBlock();
$params['params']['postOutput'] =
Dwoo_Compiler::PHP_OPEN.
"\n/* -- end with output */\n".
'$this->setScope($_with'.
(self::$cnt).
', true);'.
"\n}\n".
Dwoo_Compiler::PHP_CLOSE;
return Dwoo_Compiler::PHP_OPEN.
'if ('.
$cparams['var'].
')'.
"\n{\n".
'$_with'.
(self::$cnt++
).
' = $this->setScope("'.
$rparams['var'].
'");'.
"\n/* -- start with output */\n".
Dwoo_Compiler::PHP_CLOSE;
public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content)
return $content .
$params['postOutput'];
Documentation generated on Sun, 03 Aug 2008 15:12:48 +0200 by phpDocumentor 1.4.0