Re: Re: New thread - Template base class design

From: Date: Fri, 11 Jun 2004 03:48:58 +0000
Subject: Re: Re: New thread - Template base class design
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-30467@lists.php.net to get a copy of this message
On Jun 10, 2004, at 10:40 PM, Paul M Jones wrote:
On Jun 10, 2004, at 10:34 PM, Greg Beaver wrote:
Paul M Jones wrote:
I'm skipping to the interesting part (for me).
ditto ;)
It does mean that one would have to set all vars singly ... unless setData() interfaced with the class vars themselves, not some sort of $vars array, e.g. ... function setData($array) {
    foreach ($array as $key => $val) {
        if ($key{0} != '_') {
            $this->$key = $val;
        }
    }
}
Another idea: if we provide a "fromObject" method that is like so:
Things like extended DB_Result objects can set template data directly, then. Ehhxcellent. Am working on a basic "driver" piece now, Alan is certain to have better ideas than me on that one; am copying the DB/Horde/whoever methodology directly from a message Jan Schneider sent me in the Text_Wiki Earthquake thread.
OK, it's probably stupid, but have split my example into two classes: Template (for the factory/create method) and Template_Common (for the common API). First time I've really tried this, am trying to copy from others' work here. -- Paul M. Jones Savant: the simple alternative to Smarty for PHP. http://phpsavant.com/ DB_Table: build RDBMS tables and XHTML forms in one PHP class. http://wiki.ciaweb.net/yawiki/index.php?area=DB_Table Yawiki: your collaborative online documentation system. http://yawiki.com/ Yawp: a single-file foundation for PHP applications. http://phpyawp.com/

« previous php.pear.dev (#30467) next »