On 10/4/10 3:35 PM, Thomas Rabaix wrote:


On Mon, Oct 4, 2010 at 3:11 PM, Fabien Potencier
<fabien.potenc...@symfony-project.com
<mailto:fabien.potenc...@symfony-project.com>> 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.


There is many reason why the value need to be changed :

    * apply another themes

Based on a theme, the CSS/JS changes. Then, you would have a custom helper to add the CSS/JS, or you have a convention between the path and the theme. No need to have a view.yml file (which won't solve this specific problem either).

    * use another javascript library version

View.yml does not solve this problem. But this problem does not exist in Symfony2 as bundles cannot/should not comes with third party libraries; which means that the inclusion of JQuery for instance will be up to the end-user.

    * centralize plugin version. If 2 bundles uses 2 different jQuery
      version, you will have 2 jQuery files inside your page. So the
      only solution will be to overwrite the template ?

same answer as previous question.

And the same goes for the layout declaration, if the name is hardcoded
inside the template, it will be a nightmare to find a convenient
convention for changing the value. Settings the name as a variable looks
odd too : which component will initialize the value ? each
bundle developer will have her/his own convention.

Bundles must not comes with the main layout. Their templates must extends a user layout. We still need to define which slots/blocks need to be declared in the base template though.

Fabien

Hardcoded values can work for custom code, but not for shared
bundles across different applications.


    Fabien

        On Mon, Oct 4, 2010 at 2:21 PM, Fabien Potencier
        <fabien.potenc...@symfony-project.com
        <mailto:fabien.potenc...@symfony-project.com>
        <mailto:fabien.potenc...@symfony-project.com
        <mailto:fabien.potenc...@symfony-project.com>>> wrote:

            On 10/4/10 2:14 PM, Thomas Rabaix wrote:

                Hello,

                Ok, there is no view.yml file in Symfony2. The current
        document
                states
                that css, js and layout declaration can be defined
        inside the
                template
                [1]. But for now there is no way to do so in a general
        way (like
                the old
                view.yml). The drawback is that dependencies are set inside
                templates,
                which is not good for easy customization and
        maintenance. (If
                the user
                want to set another css files or layout from the one
        provided in
                a bundle.)


            I'm not sure I understand the problem. In Symfony2, you can
        have a
            deeply nested set of layouts. In each of these layouts, you
        can add
            CSS, JS, ... So, I think this is much more powerful than the
            view.yml, as you are not restricted to
        project/module/action. Or am
            I missing something?

            Fabien

                Symfony2 introduces DIC as its main feature, but not for
        templating.

                [1]
        http://docs.symfony-reloaded.org/quick_tour/the_view.html
                --
                Thomas Rabaix
        http://rabaix.net

                --
                If you want to report a vulnerability issue on symfony,
        please
                send it
                to security at symfony-project.com
        <http://symfony-project.com> <http://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
        <mailto:symfony-devs@googlegroups.com>
        <mailto:symfony-devs@googlegroups.com
        <mailto:symfony-devs@googlegroups.com>>

                To unsubscribe from this group, send email to
        symfony-devs+unsubscr...@googlegroups.com
        <mailto:symfony-devs%2bunsubscr...@googlegroups.com>
        <mailto:symfony-devs%2bunsubscr...@googlegroups.com
        <mailto:symfony-devs%252bunsubscr...@googlegroups.com>>

                For more options, visit this group at
        http://groups.google.com/group/symfony-devs?hl=en


            --
            If you want to report a vulnerability issue on symfony,
        please send
            it to security at symfony-project.com
        <http://symfony-project.com> <http://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 <mailto:symfony-devs@googlegroups.com>
        <mailto:symfony-devs@googlegroups.com
        <mailto:symfony-devs@googlegroups.com>>

            To unsubscribe from this group, send email to
        symfony-devs+unsubscr...@googlegroups.com
        <mailto:symfony-devs%2bunsubscr...@googlegroups.com>
        <mailto:symfony-devs%2bunsubscr...@googlegroups.com
        <mailto:symfony-devs%252bunsubscr...@googlegroups.com>>

            For more options, visit this group at
        http://groups.google.com/group/symfony-devs?hl=en




        --
        Thomas Rabaix
        http://rabaix.net

        --
        If you want to report a vulnerability issue on symfony, please
        send it
        to security at symfony-project.com <http://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 <mailto:symfony-devs@googlegroups.com>
        To unsubscribe from this group, send email to
        symfony-devs+unsubscr...@googlegroups.com
        <mailto:symfony-devs%2bunsubscr...@googlegroups.com>
        For more options, visit this group at
        http://groups.google.com/group/symfony-devs?hl=en


    --
    If you want to report a vulnerability issue on symfony, please send
    it to security at symfony-project.com <http://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
    <mailto:symfony-devs@googlegroups.com>
    To unsubscribe from this group, send email to
    symfony-devs+unsubscr...@googlegroups.com
    <mailto:symfony-devs%2bunsubscr...@googlegroups.com>
    For more options, visit this group at
    http://groups.google.com/group/symfony-devs?hl=en




--
Thomas Rabaix
http://rabaix.net

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

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