Re: Re: New thread - Template base class design

From: Date: Fri, 11 Jun 2004 03:55:38 +0000
Subject: Re: Re: New thread - Template base class design
References: 1 2 3 4 5  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-30468@lists.php.net to get a copy of this message
I did consider the factory method + base class very early on, but it raises the ugly head of just delivering the same problem we have at present (lots of similar template engines, with little recycling or working together) I'll have to comment more tonight - as I've got to get back and finish some paid work :) Regards Alan Paul M Jones wrote:
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.
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

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