0

What is reference name="right", how many types, how to add custom reference name="test"?

4

reference almost always refers to a previously added <block>.

So if you add a block like below in your layout XML file you can later on reference this block via reference name="test".

<block type="core/template" name="test" template="yourextension/test.phtml"/>
| improve this answer | |
2

Reference is a tag which will refer the block which is already defined in layout files and you want to use that block in page or you want to add more blocks in it.

In page.xml file you will find the xml like:-

<block type="core/text_list" name="right" as="right" translate="label">
            <label>Right Column</label>
        </block>

if you are using <reference name=right> means you are using or accessing the right block which is already defined in page.xml file and you can update it.

If you want to see the example then you can check catalog.xml files in layout folder

<reference name="right">
    <block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
    <block type="core/template" name="right.permanent.callout" template="callouts/right_col.phtml">
        <action method="setImgSrc"><src>images/media/col_right_callout.jpg</src></action>
        <action method="setImgAlt" translate="alt" module="catalog"><alt>Keep your eyes open for our special Back to School items and save A LOT!</alt></action>
    </block>
</reference>

so in the right block its adding sidebar.phtml and right_col.phtml files in a right block.

Hope its helpful for you.

| improve this answer | |

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.