Re: Play nice! Re: Savant/Flexy/Foo template engines
| From: | Tomas V.V.Cox | Date: | Thu, 10 Jun 2004 09:27:20 +0000 |
| Subject: | Re: Play nice! Re: Savant/Flexy/Foo template engines | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-30368@lists.php.net to get a copy of this message | ||
My opinions:
Alan Knowles wrote:
A few points came up: toFile().. - Seems a rather low usage method, - that gets more messy, the more you add to it.. handling resources or filenames.. etc. - I wonder if it is really a good idea to include it.. in php5 they can just do $e = $tmpl->toString(); if (!is_object($e) ) { file_put_contents($e); }It's fine so.
the variables I've used are public. - end users can treat them as private if they wish. (eg. use only the assign API etc,).. 99% of the time end users will not need to bother accessing them directly, but on the offchance someone wants to, as long as they understand what it does, there seems to be minimal issues with letting them loose on it.. (it's not like the API is going to change dramatically much more...... famous last words... )Is supposed that the class is going to be extended? If to, Flexy internal vars (like options) should be protected no?
The options array in Flexy is tooooo big already.. - I suspect the best idea is to a) comment out options that are not used by the core file. (leaving the documentation in there) b) when any of the providers (that use those options) are loaded, the user provided & the provider's defaults are merged.I'd go with b).
--------------------------------------------------------------------------------------------------------- Questions: a) Should this be HTML_Template?The class shouldn't be restricted to HTML, I used templates in the past for just .txt files and know people who even do it with .doc files. For XML could be helpful too. Template would be my vote.
b) Should it remain as HTML_Template_Flexy ** in which case it should really be Flexy2 (even though Flexy never made it to stabe ;)Nah, let's pollute from one time the main Template space ;)
c) What is missing- Does the tokenizer detect strings at Javascript code? - I saw the nice number format option, could it be set to locale? Why not do something similar with dates? - About the rewriting engine, a think like images/:images/{$flexy_locale}/, would help full i18n - By default I'd not let php code in templates if they are not compiled, is imho a security risk. - Please keep the usage as simple and easy as possible, is the only way to get success.
d) What could be removed?This is weird: $this->options = $this->options + $GLOBALS['HTML_Template']['options'] + $options ; :-D Tomas V.V.Cox