Re: flexy global functions
| From: | Demian Turner | Date: | Thu, 29 Apr 2004 08:58:59 +0000 |
| Subject: | Re: flexy global functions | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-12213@lists.php.net to get a copy of this message | ||
hi Alan
apologies for the slow reply:
filed{if:GLOBALS.is_array(v)} ... do something {end:} however this does not seem to work. the 'globalfunctions' = true is set.can you file it as a bug - I need to fix it..
sounds very much like what I'm trying to explain - the ability to make a number of methods available to a namespace, as you say <seagull:method1(arg1,arg2)> <seagull:method2(arg3,arg4) ... following the current tag attribute convention, i'm not sure if the mapping is ideal for method calls, for example, <seagull:generateSelect options="aKeyValueList" selected="myKey"> how methods are currently made available is a much more intuitive one-to-one mapping, ie {generateSelect(aKeyValueList,myKey)} the attractiveness of such a feature is that, for example in our framework, say we have 50 html transform methods, we have 2 options - load a huge static method lib file with every page exec, very inefficient when only 1-2 methods are called - load a separate lib for each module, messy If such template methods could be incorporated into Flexy, then once compiled, this potentially huge class would never get called :-)an a related note, it is possible to create custom functions for flexy? i know this was implemented for the old regex parser, don't think it works the current one. currently we're using the output object to add methods which can be called by flexy templates, however the issue is that say we have 50 html transform methods, we call all of them every page execution even if the current page uses only one of them. the advantage of having them in flexy (i believe) is that if the pages are compiled, the addition html methods won't get included/called, making the process considerably more streamlined.have you got a simple example, so I can get my head round the requirements.. Technically, the Tag Namespace handler is supposed to deal with this, although It's more a proof of concept.. eg. at present <flexy:toJavascript is in HTML/Template/Flexy/Compiler/Standard/Flexy.php if you start using: <seagull:dosomething .... it should call HTML/Template/Flexy/Compiler/Standard/Seagull.php or <XUL:textarea .... calls HTML/Template/Flexy/Compiler/Standard/XUL.php
at present, the file path is hard coded.. it may be worth adding yet another option: 'namespaceHandlers' => array(agreed that including the 3rd party lib outside of the pear class library would be a good idea. what do you think? cheers demian'XUL' => '/myproject/XUL.php' /// maps to class : myproject_XUL)