Page 1 of 1

Question PEAR::DB , Smarty, OOP

Posted: Wed Oct 13, 2004 2:27 am
by harsha

Code: Select all

<?php
class smartyDB{

	var $ooContainer;
	var $ooResult;
	var $ooRow;

	function smartyDB(){
		$this->Container = array();
        $this->ooResult = NULL;
        $this->ooRow = NULL;
	}
	
	function getMatrix($Sql, $dbHndl){
		$this->ooResult = $dbHndl->query($Sql);
		while($this->ooRow = $this->ooResult->fetchRow(DB_FETCHMODE_ASSOC)){
			array_push($this->ooContainer, $this->ooRow);		
		}
	}
	
	function setMatrix($Name, $smartyObj){
		$smartyObj->assign($Name, $this->ooContainer);
	}
}
?>
I want to do something like, mentioned above with out using include "DB.php" or "smarty.class.php", how do I do that? The above raw method is okay?

It is like, I have included

smarty.class.php
DB.php

in /Index.php

and the above code is in /classlib/smartydb.php

is it possible that one child class extends two parent or base classes?
some thing like


smarty extends DB and also extends Smarty :D :?: :?

Posted: Wed Oct 13, 2004 2:38 pm
by timvw
afaik "multiple inheritance" is not supported by php(4|5)

you could emulate it through aggregation

http://www.sitepoint.com/article/dual-i ... lasses-php