On 1/24/11 5:02 PM, Jérôme TEXIER wrote:
Hi Fabien,

My question is just what is the best way to use some user-defined
helper functions (for instance a bread crumb function) on Twig.
Before PR5, I was injecting helper class (Templating\Helper
\FooHelper.php) on the view and had access to those functions via the
former _view variable.

I was thinking on how to use those functions now without the _view
variable.
I understand now that I simply should define those functions as
Twig_Function_Method on a TwigExtension.

Two possibilities:

 * create a Twig function (so you have {{ foo() }})
 * register a global variable (so you have {{ foo.bar() }})

Fabien


On 24 jan, 00:48, Fabien Potencier<fabien.potenc...@symfony-
project.com>  wrote:
On 1/24/11 5:20 AM, Jérôme TEXIER wrote:

Hello,

sincehttps://github.com/symfony/symfony/commit/b60d254be2f9b9a8b1340a8f7b4...
_view variable no more exist on templates.
Before PR5, I was using this variable to access to some injected Twig
helper functions.
It doesn't seem really clear to me now what it's best way to do it now
without this variable.
Should we use request global variable to get a defined helper
service ?

Can you give me an example of what you are trying to do?

Fabien


--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to