2

I created a module that uses the "before_body_end". On some pages a second module also uses before_body_end. Is there a way to dermine the order ?

example:

<div class='mymodule'></div>
<div class='3rdpartymodule'></div>
</body>

to :

<div class='3rdpartymodule'></div>
<div class='mymodule'></div>
</body>

3 Answers 3

3

An addendum to @marius' answer, rather than place the core dependency in a core override you can state the dependency in your own module so that disabling it also disables the dependency:

<?xml version="1.0"?>
<config>
    <modules>
        <YourCompany_YourModule>
            <active>true</active>
            <codePool>community</codePool>
        </YourCompany_YourModule>
        <Mage_Customer>
            <depends>
                <YourCompany_YourModule/>
            </depends>
        </Mage_Customer>
    </modules>
</config>
6

in the layout XML of your extension add the after attribute to the block declaration.

<reference name="before_body_end">
   <block type="your/module" name="your_module" after="-" template="your/module.phtml"/>
</reference>

As long as the other extension doesn't do the same you should be good and your block should always be inserted last.

5

Make you module depend on the third party module. Add this in app/etc/modules/[Namespace]_[Module].xml

<depends>
    <Thirdparty_Module />
</depends>
5
  • Looks a bit like a hack. It would also mean that the third party module can't be disabled.
    – Fran
    Mar 12, 2014 at 15:53
  • Not a hack. A workaround. See my answer for an addendum to this method, @Fran
    – philwinkle
    Mar 12, 2014 at 17:15
  • This is not actually a hack. It's a feature :). If you don't like this approach you can try what @SanderMangel posted. I don't know how I didn't thing of that. It's kind of obvious.
    – Marius
    Mar 13, 2014 at 8:26
  • Sorry but this is a dirty solution. @Sander provided the right answer there. Your solution would imply the first module DEPENDS on the other one, which is absolutely not true. Not saying it's not going to work, it's just not a very clean way to achieve it.
    – Fran
    Mar 13, 2014 at 17:18
  • 1
    @Fran I totally agree with you on this.
    – Marius
    Mar 13, 2014 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.