How can i get a var_dump'd list of all loaded reference names for a page (hack a core file temporarily).

I'm attempting to load a block that injects some javascript ajax stuff and it uses a url stored in the magento custom variables. This forces me to use a block with php that echos the magento custom variable, and then show it in the block "varinject".

I'm trying to determine which references are loaded on any page I am on... for instance, my block is loaded like this in my design layout xml...

    <reference name="head">
        <action method="addJs">
        <action method="addCss">
    <!--Magento omits the ->getChildHtml() from head, so you HAVE to use something else to render blocks-->
    <reference name="content">
        <block type="nki_customer/adminhtml_varinject" name="nki_customer_varinject" template="nki_customer/varinject.phtml"/>


The thing is, I know that in magento admin, 'head' does not load child html. For unknown reasons (probably to purchase enterprise) they do not do that. 'Content' does, but it is not used everywhere.

I am not going to modify nor override core design files at this time, so please no suggestions to add $this->hildHtml() to the admin head phtml file.

I would love to know which core file I can open and just add a good ol' var_dump($something) and it will throw a giant list of the references used on the page.

1 Answer 1


In app/code/core/Mage/Core/Model/Layout.php you can add

Mage::log($name, null, 'blocks.log', true);

before line 459 (Magento 1.9.2):

Mage::dispatchEvent('core_layout_block_create_after', array('block'=>$block));

(oh look, there is an event hint hint)

This will add the names of all created blocks to /var/log/blocks.log, i.e. all names that you possibly can use as reference. I would not use var_dump here because this line is executed for each single block.

If you really want to dump all names at once, this line at the bottom of index.php is also possible:


Your Answer

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

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