Hi,

I understand how the concept of "traits" aka "Horizontal
Reuse<http://www.twig-project.org/doc/templates.html#horizontal-reuse>"
introduced in Twig 1.1

Is it possible to embed a controller with twig and having the same features
?

In fact I have a template which embed a controller.
This controller render an action having javascripts.

The good way is to display the javascript at the end of the html body.
To do that as described in SF2 doc, I have a "javascripts" twig block at the
end of my layout.html.twig (just before </body>

But I can't manage to add javascript code to this block from the embed
controller template.

If there was no embed controller but an embed template I would do :
Layout template:
[...]
{% block content %}
{% endblock %}
[...]
{% block javascripts %}
    //main javascripts code
{% endblock %}

Controller template :
{% extends 'ComOceanIntranetBundle::layout.html.twig' %}
[...]
{% block content %}
    {% render "MyBundle:myEmbedController:myAction" with myembed_javascripts
%}
{% endblock %}
[...]
{% block javascripts %}
    {{ parent() }}
    // my controller/action javascripts code
    {{ block('myembed_javascripts') }}
{% endblock %}

myEmbedController template :
[...]
{% block myembed_javascripts %}
    //my embed controller/action javascripts code
{% endblock %}


This doesn't work because render seems to have "include" behavior and not
"use" behavior.

Then how to add javascripts to the layout from myEmbedController template in
that situation ?

Is it possible or it need a concept of Embed controller Horizontal Reuse ?

Thanks a lot,

-- 
Sylvain PAPET
Développeur Web
Agence de communication Com-Océan
www.com-ocean.com

-- 
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 symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to