[PHPTAL] phptales implementation

Laurent Bedubourg lbedubourg at motion-twin.com
Thu Feb 15 12:38:32 CET 2007


Richard Standbrook wrote:
> Hello,
> 
> I am also having trouble with tales. I worked out how to use them but I 
> don't seem to be able to use any of the built in tales like path, I am 
> trying to call phptal_tales_path inside() my custom tale but it claims 
> "Call to undefined function phptal_tales_path" 

Hi Richard,

Can you post your custom expression code, so we can see where the 
problem comes from ?

> I am a bit confused about the new registry patch from Moritz Bechler. 
 > Does this change how tales
> are used? can I use class methods as tales? and how do I call an 
> internal tale?
> 

The registry system is backward compatible you can still use simple 
functions.

Builtin function have moved to PHPTAL_TalesInternal.

To register a modifier using the the system you have to call :

PHPTAL_TalesRegistry::getInstance()->registerPrefix($prefix, $callback)

where $prefix is your tales expression modifier name
and $callback is a function name or an array(classname, methodname)

You can call builtin tales using :

PHPTAL_TalesInternal::* static methods

PHPTAL_TalesInternal::path($exp, $nothrow)
PHPTAL_TalesInternal::string($exp, $nothrow)
etc...

Best regards
Laurent

-- 
Laurent Bedubourg
lbedubourg at motion-twin.com
http://www.motion-twin.com



More information about the PHPTAL mailing list