[TYPO3-mvc] Re: SingleAliasViewHelper
Nils Blattner
nb at cabag.ch
Fri Feb 19 10:15:57 CET 2010
Simple alias ViewHelper to do some work with dynamic paths that I could
not get to work in the AliasViewHelper of the fluid package.
<?php
/* *
* This script is part of the TYPO3 project - inspiring people to share! *
* *
* TYPO3 is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License version 2 as published by *
* the Free Software Foundation. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
* Public License for more details. *
*
*/
/**
* This ViewHelper defines a single alias.
*
* @author Nils Blattner <nb at cabag.ch>
* @version $Id:$
* @license http://opensource.org/licenses/gpl-license.php GNU Public
License, version 2
* @scope prototype
*/
class Tx_CabagSteps_ViewHelpers_SingleAliasViewHelper extends
Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
/**
* Defines a new alias
*
* @param string $key Key of the new alias.
* @param mixed $value The value of the new alias
* @return string Rendered output
* @author Nils Blattner <nb at cabag.ch>
*/
public function render($key = '', $value = NULL) {
if ($value == null || empty($key) || !is_string($key)) {
return $this->renderChildren();
}
$this->templateVariableContainer->add($key, $value);
$output = $this->renderChildren();
$this->templateVariableContainer->remove($key);
return $output;
}
}
?>
More information about the TYPO3-project-typo3v4mvc
mailing list