Re: [PEPr] Comment on HTML::Template_Savant
| From: | Alan Knowles | Date: | Thu, 03 Jun 2004 04:20:06 +0000 |
| Subject: | Re: [PEPr] Comment on HTML::Template_Savant | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-29940@lists.php.net to get a copy of this message | ||
Ok I underestimated a little.. 66 lines.
http://devel.akbkhome.com/svn/index.php/akpear/Savant_tests/Savant.php
there's no filter code in there, I was thinking something along these lines would be the best way to implement filtering..
$template = new HTML_Template_Flexy(...)
$filter = new HTML_Template_Flexy(
'compiler' => 'regex',
'filters' => array(
'email',
'filter' => 'myfilters/filter1.php'
)
);
$template->assign(.....);
$template->compile('mytemplate.tpl');
$filter->compileString($template->toString());
$filter->output();
----------
I've dumped the filter_dir / plugin_dir stuff - the array( class=>location) seems alot clearer..
Regards
Alan
Paul M Jones wrote:
Hi, Alan, Dueling coders. :-) I just brute-forced a refactored Savant specifically for PEAR, and I think I've done most of the things to mine that you did to yours. I love asymptotes. :-) * Plugins and filters are all by instance now, never static. Error code messages are now globals for easier i18n. * Have done a slap-dash conversion to PEAR_ErrorStack, not sure if it's right (all running through the old throwError() method). * Have added plugin and filter configuration arrays so you can configure them at runtime. * Have removed the mapPlugin and mapFilter methods for simplicity's sake (this is a BC break for those who were using it, but I think the number of users was small to nonexistent). * Flexy won't need plugin and filter base classes in its new evolution, but I'm still requiring them in the new Savant. Biggest deal: I have added a stub "compile" method, in a major nod to Joshua Eichorn's ideas on modular template design. I don't like it, but I can give a little on that front. It does nothing significant on its own, but it will allow those who like it to extend Savant to compile templates, as it gets called by fetch() and display() to point to the proper template source. This does not introduce any BC breaks with the current Savant architecture. You can see the new (ugly) code here ... http://wiki.ciaweb.net/yawiki/index.php?area=Savant&page=SourceCode ... and the (ugly) diff here: http://wiki.ciaweb.net/yawiki/index.php? area=Savant&page=SourceCode&view=diff&to=2004-06 -02+21%3A49%3A59&from=2004-06-01+13%3A11%3A33 On Jun 2, 2004, at 8:05 PM, Alan Knowles wrote:-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.comFair enough -- for my edification, when does it get called? I thought Flexy was a compiling template system.In real life, the Compiler class is never included (as you dont change the template after you have installed the application ususally).The bulk of the code in Flexy's core class is really about a) set up the options. b) does the template exist (in any of the source folders) c) doing some tweaking on the object prior to outputting..... and while I may be mistaken, it looks to me that a missing (d) is "calling the compiler class to compile the template."Nicely done, and so fast! I'm impressed. :-)I'm not sure line counts are the best thing to compare on this kind of issue, even if it does turn out that Flexy has more (or less, even). My point is that Flexy has an idea about its normal mode, and Savant has an idea about *its* normal mode; I don't think the two really merge, and I think Flexy expects a bit more from the developer-user than Savant does. But that's just me.Do have a look - The merge is pretty much done, The tests link I sent yesterday illustrates the the changes to the end user API is pretty minor.you could even write full Savant emulator API wrapper for flexy in < 30 lines now ... :)And one could write a full Xipe, Flexy, or other emulator with this new Savant, as the compile method is wide open. Of course, one doesn't need it when one writes their templates in natural PHP. :-) OK, going to bed now, the day has worn me out.