Re: Play nice! Re: Savant/Flexy/Foo template engines

From: Date: Thu, 10 Jun 2004 09:46:23 +0000
Subject: Re: Play nice! Re: Savant/Flexy/Foo template engines
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-30372@lists.php.net to get a copy of this message
Is supposed that the class is going to be extended? If to, Flexy internal vars (like options) should be protected no?
The only justification I can think of to extend it is a) to provide BC API wrappers b) someone wants to have their own private engine, and add a few utility methods...???? since I pass the core object around alot to other objects, those other objects need to have access to the options array anyway.
c) What is missing
- Does the tokenizer detect strings at Javascript code?
the tokenizer ignores Javascript completely.. if you are using the tokenizer backend, you should use something like <flexy:toJavascript javascript_var="php_var"> <script type="text/javascript"> javascript_var = 'a default'; </script> </flexy:toJavascript> This enables you to test the template and the javascript without compiling it..
- I saw the nice number format option, could it be set to locale? Why not do something similar with dates?
Thats a kludge, I suspect the best way to handle this is really to use {plugin(#mynumberformat#,thevar)} -- or make the plugins callable as modifiers.. : eg. {var:mynumberformat} does the same as the above..
- About the rewriting engine, a think like images/:images/{$flexy_locale}/, would help full i18n
Another very kludgy implimentation :) - I think the engine should really replace the <img src="images/someimage.gif" with <img src="<? echo $this->plugin('ImageSource::fix', 'images/someimage.gif') ?>" .... and 'compiler.standard.image_rewriter' => array('myclass','imagefixer') or something...
- By default I'd not let php code in templates if they are not compiled, is imho a security risk.
That's Flexy's current behavior
- Please keep the usage as simple and easy as possible, is the only way to get success.
yeah - the dumbest usage Savant Mode: $x = new Template(array('template_dir'=>dirname(__FILE__)); $x->open('mytemplate.php'); $x->outputWithData(array( 'variables' => array(
      'somevar1' => 'xxxx'
))); dumbest usage Flexy/Tokenizer Mode: $ x = new Template(array(
        'template_dir'=>dirname(__FILE__)
        'complier'=>'Standard',
); $x->open('mytemplate.html'); $x->outputWithData(array( 'object' => $this)); with Assign API: $x = new Template(array('template_dir'=>dirname(__FILE__)); $x->open('mytemplate.php'); $x->setData('somevar1','xxxx'); $x->output(); etc....
d) What could be removed?
This is weird: $this->options = $this->options + $GLOBALS['HTML_Template']['options'] + $options ;
yeah - I cant remember if this works quite well as an array_merge on options.. - been a while since I tested it..
:-D Tomas V.V.Cox


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