Salut :)

you should get what you need with this in your controller :

$environement = $this->container->get('kernel')->getEnvironment();
//-----------
return array( 'environement'=>$environement ); // send value to the
view

and this kind of statement in your template  :

{% if environement="dev" %}
     // display some specific twig template for only for "Dev"
{% else%}
    // display some specific twig template for only for "Prod"
{% endif%}

there is a another way , i think , to get the environement directly in
the template with something like  : {{ app.kernel.....}} but I'm not
sure, i'll check if I found it I'll let you know.
Hope it hepls !!

bonne journée François :)

On 19 oct, 15:31, Francois Mazerolle <[email protected]>
wrote:
> Hi,
>
> I'm trying to make a bundle that add a functionality to the twig
> rendering process.
> Basically, I need Twig to call a custom function before the
> doDisplay() method is called.
>
> To explain a bit the context, when in development mode, I need to wrap
> the content of
> each template file into a custom <div>, and add a couple of info.
>
> Looking at the Twig_Template and the cached template, I see no trace
> of hooks or event, and
> doesn't see how I could integrate that kind of feature without
> modifying directly the file.
>
> Tips&hints would be welcome.

-- 
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