Author - Robert Popovic

Founder and Technical Director of LERO9, a web agency specializing in Magento and WordPress design and development.

I launched Magebase in April, 2010 and am its editor and contributor. My main topics of interest are Magento development, customization and how to get the most out of Magento with the least amount of headache.

More Info » Follow me on Twitter »

Reader Comments (5)

  1. Links 34/2011: Magento, e-Commerce und Entwicklung allgemein

    […] ändern.Eine schöne Idee, die ich aufgreifen möchte, wird bei magebase beschrieben: man soll die Einbindung von JS-/CSS-Dateien für Extensions über das Backend konfigurierbar machen.Fabrizio hat seine Extension Aoe_Scheduler um eine optische Timeline erweitert, mit der man […]

  2. Colin
    September 2, 2011 at 6:25 am /

    Unfortunately this only works with yes/no configuration. What if you want to let the user choose (say between different stylesheets or jQuery vs Prototype)? I suppose you could write a custom backend for your configuration that would save the value of a select as a series of yes/no answers for each option, or is there a better way?

  3. Colin Mollenhour
    September 3, 2011 at 2:43 am /

    The $cond parameter checks if a property on the block is set but does no value comparisons.

    However, this would be a little easier than using a custom backend (though less extensible):

    <reference name="head">
        <action method="addCss" ifconfig="my_config_section/advanced/load_css">
            <stylesheet helper="myhelper/getStylesheet"></stylesheet>
        <action method="addItem" ifconfig="my_config_section/advanced/load_js">
            <name helper="myhelper/getJs"></name>

    Then ‘myhelper’ needs to have methods getStylesheet and getJs which return the relative path of the css/js to include.

    NOTE: I haven’t tested the above but from reading Mage_Core_Model_Layout->_generateAction it should work.

  4. Dmitry
    December 25, 2012 at 7:53 pm /

    Hello Robert. Thanks for the clear guide. Just one more question 🙂 Do you know if it is possible to add CSS or JavaScript conditionally depending on OS or browser. For example I need to add some CSS changes but only for Mac OS safari browser. I know how to do this using PHP but I could not find how to add it using Magent xml files (if it is possible at all).


Add a Comment & Join the Discussion

Insert small snippets of code by using [code]{your_code_here}[/code]
For larger code blocks please use and paste your link.

You may also use the following HTML in your comment: <a href="" title=""> <abbr title="">
<acronym title=""> <blockquote cite=""> <cite> <em> <strike> <strong>