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);
	}
}

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

  • Digg
  • del.icio.us
  • blogmarks
  • Reddit
  • Simpy
  • StumbleUpon
  • Technorati
  • description
  • Ma.gnolia
  • Slashdot
  • Sphinn
  • Spurl

Related Posts

Cheap Life Insurance Quote

Tags: , ,

Viewing 1 Comment

    • ^
    • v
    Some immediate problem to make code workink.
    1-
    [14-Aug-2008 15:10:58] PHP Fatal error: Call to undefined method User::fetchRowToArr() in C:\wamp\www\zfcms\classes\ExtController.php on line 291

    missed from .classes\ExtModel.php function fetchRowToArrow ...
    i find that function in Wrinting a Cms/coomunity .... : Part 2 and added at the end of file

    function fetchRowToArr($id_value = false, $as_array = true, $id_field = false, $where = false){
    if($where != false){
    $where_sql = array();
    foreach($where as $field => $value)
    $where_sql[] = $this->getAdapter()->quoteInto("$field = ?", $value);
    $row = $this->fetchRow($where_sql);
    }else if($id_field == false){
    $row = $this->find($id_value)->current();
    }else{
    $where = $this->getAdapter()->quoteInto("$id_field = ?", $id_value);
    $row = $this->fetchRow($where);
    }

    if($as_array == true && $row != false)
    return $row->toArray();
    else
    return $row;
    }

    2-
    [15-Aug-2008 15:46:38] PHP Fatal error: Class 'Zend_Mail' not found in C:\wamp\www\zfcms\controllers\UserController.php on line 208
    [15-Aug-2008 16:17:11] PHP Fatal error: Class 'Zend_Mail_Transport_Smtp' not found in C:\wamp\www\zfcms\controllers\UserController.php on line 209

    in .index.php we must load zend module for mail

    // added by rg
    Zend_Loader::loadClass('Zend_Mail');
    Zend_Loader::loadClass('Zend_Mail_Transport_Smtp');

    3- investigation about
    [15-Aug-2008 16:04:49] PHP Fatal error: Call to undefined method User::updateMe() in C:\wamp\www\zfcms\controllers\UserController.php on line 150

    Function already in the pencil ???

    hope this can help someone - thank for the excellent job done

    Gianni

Trackbacks

close Reblog this comment
blog comments powered by Disqus