On 04.10.2010 15:11, Fabien Potencier wrote:
> On 10/4/10 2:52 PM, Thomas Rabaix wrote:
>> I have one question : how can I change a css or javascript declaration
>> if the value is hard coded inside the template file ?
> 
> I'm not sure I understand the question. Within a template/layout, you
> know which CSS and JS you need, so yes it is "hardcoded", but there is
> no need to change it, right? And if you want it to be "dynamic", you can
> have a variable.

Short example of how you could do this with a "view.yml"-like variable:

# config.yml

parameters:
    css.files:
        - foo.css
        - bar.css

# controller

$data = array(
    'cssFiles' => $this->container->getParameter('css.files'),
);

# view

{% for file in cssFiles %}
    {% stylesheet file %}
{% endfor %}

P.S.: Untested code ;)

Cheers

-- 
Jordi Boggiano
@seldaek :: http://seld.be/

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