ZF Community/CMS Bugfixes

I’m in the process of replacing the horrible PHP code. And I’m using the beefed up version of the Zend Framework that I’ve built in this series of course! However, I’ve started to find some bugs and the fixes will be posted here.

First up is a problem with fetching several templates in the same controller, here is the fix in in ExtController:

function setSmartyTplDir($addition){
	$dir_arr = explode("/", $this->smarty->template_dir);
	if($addition != array_pop($dir_arr))
		$this->smarty->template_dir .= "/".$addition;
}

function fetch($template = false, $folder = false){
	if($template == false){
		$this->smarty->template_dir .= "/".$this->name;			
		return utf8_encode($this->smarty->fetch($this->template));
	}else{
		if($folder !== null){
			if($folder == false)
				$this->setSmartyTplDir($this->name);
			else
				$this->setSmartyTplDir($folder);
		}
		return $this->smarty->fetch($template);
	}
}

———————————————-


Related Posts

Tags: , ,