Re: IT, or templates in general - another approach
| From: | Wolfram Kriesing | Date: | Tue, 21 May 2002 16:09:13 +0000 |
| Subject: | Re: IT, or templates in general - another approach | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6288@lists.php.net to get a copy of this message | ||
Alan Knowles wrote:
Wonderfully offtopic :) -- Personally I view The design of Simpletemplate is 'far superior to IT/IT[x] etc.' and I used it as a basis for my own little engine.. http://docs.akbkhome.com/PHPcodedoc/classes/Template_Engine.html http://docs.akbkhome.com/PHPcodedoc/classes/Filter_simpletags.html from a view 'up above' the two 'templating philosophies' appear to be ITX/IT/fasttemplate/phplib template = str_replace'ing at execution time smarty/simpletemplate/(my little hack of simpletemplate) = replacing templating with php code and executing that code at runtime.are there any plans of integrating something like the different kind of approaches for template engines in PEAR? or will IT[X] stay the only one?
anyway, if you have a look at my derivative, you'll see a few diffences that would be nice to merge togetherdefinitely, i would really be interested in merging the stuff together and making it better with your ideas :-) (and code if u want)
- the xml/config stuff would be nice to extracted into a parent class - not part of the core engine. = doesnt look to difficult to do. - I can see the use of it, but most of the normal stuff doesnt need it.yes, i was already thinking about this too
- In simpletemplate all the filters have to be loaded and have their methods registered and have to be instantated for each usage - the way I looked at it, each filter should be regarded as an driver/factory, once included (only if a compile is needed), all methods are included en mass., this way you just say I want filter package 'x', and it gets loaded only if the template needs generating (2-3 less includes per exectution) - you can also extend etc. the filters.... to suit your needs - like the rtf_simpletags...yes too :-)
rather than the setoptions concept..the setOption seems cleaner to me, but we could enable both
the simpletags I devised did pretty much what smarty does - eg. {this.var.xxx} => maps to <?=htmlspecialchars($this->var->xxx)?> have a look at the filter for a more detailed list... or you could modify it to be a bit more xml friendly eg.<? echo .... ?> very easily by creating a xmlfriendly filter. It also copes with <a href="%5cthis.var.xxx%5d"> which is somthing that smarty failed on. - enabling editing of templates using mozilla's html editor.. etc. The indented html code was nice, but when you are using a wysiwyg editor, depending on html source layout is problematic.true, do you have an easy solution? or any suggestion? (BTW we could make "autoBraces" to be turned off, i think u can do this already [i just never turn it off :-) ] )
anyway - thanks wolfram, without your design+efforts, my little baby would be stillborn :u r welcome -- Wolfram ... translating template engine .... http://sf.net/projects/simpletpl ... authentication system .... http://sf.net/projects/auth