I want to add my phtml before </body> tag.

I m trying this code

<reference name="before_body_end">
    <block type="core/template" name="marketplace_player" template="magenetwork/list.phtml" />

But this phtml add in wrapper class div i want that phtml exactly before </body> tag how can i do this?

  • 1
    could you explain a bit the why for this? maybe there are better solutions which can make use of this div
    – Flyingmana
    Aug 17, 2015 at 11:52

2 Answers 2


You could try adding a new structural block and echo this out before the tag where you require.

    <reference name="root">
        <block type="core/text_list" name="my_before_body" as="my_before_body" translate="label">
            <label>My before body</label>
    <reference name="my_before_body">
        <block type="core/template" name="marketplace_player" template="magenetwork/list.phtml">

You would then need to echo out this new structural block in your page templates before the body tag

<?php echo $this->getChildHtml('my_before_body') ?>

Find page.xml of your theme and find the following

<block type="core/text_list" name="before_body_end" as="before_body_end" translate="label">

And insert the following just before:

<block type="core/template"template="page/html/magenetwork/list.phtml">

Create the template file in app/design/frontend/[package]/[theme]/template/page/html/magenetwork/list.phtml and put the following:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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