Re: HTML_Template Interface recommendation
| From: | Philippe Jausions | Date: | Wed, 12 May 2004 03:18:28 +0000 |
| Subject: | Re: HTML_Template Interface recommendation | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-29134@lists.php.net to get a copy of this message | ||
Alan Knowles wrote:
Not a bad start,Thanks... :-)
I think you realize that like the database abstraction layers, you begin to loose the advantages of each engine, by abstracting them down.Right, some advantages may be lost with some engines. However this could be improved by separating the engine from the template as I did for other engines. I didn't do that for Flexy because I was not quite sure how to handle the Flexy_Element class.
flexy's setData, should probably do if ($data === null) {Hummm. not sure. In my mind we should be able to set the values one by one by calling the "interface method" setData() as many times as we want... that would allow to populate the template in several iteration (for instance recursive calls.)$this->_templateData = $name;}
output should probably do: $elements = isset($this->_templateData->element) ?Also related to the "element" special case. With this code here, it means that the "place holder" "element" would be a reserved keyword for the template. I'm not sure it's a good idea. There may not be a work around that since the Flexy_Element is an advanced feature..$this->_templateData->element : array();$this->outputObject($this->_templateData, $elements);
toString can use outputObjectBuffered()..Good catch, I thought I used it. That's one of the reasons why I was advising that the package mainteners take care of implementing the interface..
i dont mind adding this interface flexy if you can get some level of agreement with the other engines.. :)That's the whole idea to have everybody "comply" to the interface, otherwise what's the point... ;-) I've updated the interface for Flexy toString()... http://www.11abacus.com/dev/pear/HTML_Template_Interface.phps Side note: It'd be nice if all the packages started implementing the new standard __construct() constructor. I usually do something like this to be PHP4 compatible: class b extends a { function b($param) {
$this->__construct($param);} function __construct($param) {
parent::__construct($param);} } -Philippe http://www.11abacus.com/