On 16-09-2009 at 15:44:51 Marco Pivetta <ocram...@gmail.com> wrote:

Hi there!
I've been playing around with some classes I've built and now I'm getting
some problems with PHPTAL integration. The problem is very simple:
how do I access methods of my objects from inside the template?
Is there any simple way to do that or do I have to modify the PHPTAL
sources?
What I mean is using (and using output) of something like $user->register()
or $user->getInfo() or $user->setAge(20).
Any ideas?

Of course I cannot use the '>' character to avoid breaking the XML
validity...

That's why PHPTAL allows '.' with php: expression modifier:

php:user.getInfo()

php:user.setAge(20)


If method doesn't take arguments, you can use expression without php: modifier:

user/getInfo

and PHPTAL will automatically figure out that getInfo is a method and call it.


--
regards, Kornel

_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to