[PHPTAL] Implementing phptal modifiers as static methods in
multiple classes
Anton Andriyevskyy
x.meglio at gmail.com
Fri Jun 3 09:12:19 CEST 2011
Hello.
>From the source code I can see that I'm able to use modifiers like
"className.methodName"
if my class named className implements PHPTAL_Tales.
What is bad here is that:
1. I have multiple classes implementing phptal modifiers (for better
categorization)
and
2. Their names are long
*Q1.* Is it possible to register class names to be looked for modifier
static methods?
So I do not have to write tal:content="className.modifierMethodName:
expression" but only "modifierMethodName: expression".
I found that I can use PHPTAL_TalesRegistry->registerPrefix(), but if I have
300 modifiers and I need only
few ones on each template - I would not register all them at once. Makes
sense?
*Q2.* Can this [potential] dynamic search for modifier implementors also
work with php class autoloading?
Any ideas?
So the final usage would be something like:
U1. Declare calls with static methods, maybe even phptal_tales_<modifier>
U2. Call
PHPTAL_TalesRegistry->getInstance()->registerPrefix(array('myClass1',
'myClass2', ...));
U3. Use my modifiers in templates, having php autoload in place.
Regards,
Anton Andriyevskyy
Business Automation & Web Development
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/phptal/attachments/20110603/ea8ec3f1/attachment.htm
More information about the PHPTAL
mailing list