On 19.12.2010, at 22:38, Fabien Potencier wrote:

> Hi all,
> 
> Now that Twig supports global variables and functions, I will rework the 
> TwigBundle (http://www.twig-project.org/doc/advanced.html).
> 
> Global Variables
> ----------------
> 
> One thing I will add is global variables for common things like the request 
> and the user (like symfony1 has).
> 
> The question is, how do we provide them?
> 
> 1. Register the request variable directly:
> 
> {{ request.query.foo }}
> 
> 2. Put the request variable under a "namespace":
> 
> {{ sf.request.query.foo }}
> 
> 3. Prefix the variable:
> 
> {{ sf_request.query.foo }}
> 
> My preference goes to 1 for common variables, and 2 for less common ones (3 
> looks too similar to symfony1 ;)).

I think we should make this explicit, at least for the less common ones and 
maybe even for the common ones. Aka the user decides what variables to inject. 
We have this ability in the DefaultView Jordi and I created, but the code could 
easily also be moved to the template layer.

> Globals Functions
> -----------------
> 
> * Globally:
> 
> {{ url('homepage') }}
> 
> * Under a namespace
> 
> {{ sf.url('homepage') }}
> 
> * With a prefix:
> 
> {{ sf_url('homepage') }}
> 
> As for global variables, heavily used functions like url should use 1, and 
> less common used ones can probably use 2.


Here I think users should just have to namespace their functions and core 
doesnt for anything.

regards,
Lukas Kahwe Smith
[email protected]



-- 
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 developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to