Location: PHPKode > scripts > UI Template > ui-template/frea/Template/Dom/Namespace/If.php
<?php
/**
 * @package frea-framework
 * @subpackage Template
 * 
 * @copyright 2009 frea-framework
 * @author Dawid Kraczkowski hide@address.com
 * @license  http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
 */
class Template_Dom_Namespace_If extends Template_Dom_Namespace
{
	public function insertBefore()
	{
		$replacements = array(
			"lt" => "<",
			"gt" => ">",
			"eq" => "==",
			"le" => "<=",
			"ge" => ">=",
			"neq"=> "!="
		);
		$test = str_ireplace(array_keys($replacements),array_values($replacements),$this->node->getAttribute('test'));
		$test = preg_replace("#(\\\$[a-z][a-z0-9_\\\.]*)#i","Template_VariableContainer::get(\"\\\\$0\")",$test);
		$test = preg_replace("#(@[a-z][a-z0-9_\\\.]*)#i","Template_VariableContainer::get(\"$0\")",$test);

		return "\n\n<?php if(".$test."):?>\n";
	}
	public function insertAfter()
	{

		$els = $this->node->getElementsByTagname("else");
		$i = count($els)-1;
		if($i>=0)
		{
			$else = $els[$i];
			if($else->parsedContents)
				return "<?php else:?>".$else->parsedContents."<?php endif;?>";
		}	
		return "\n\n<?php endif; ?>\n";
	}
}
Return current item: UI Template