I'm having some trouble getting a custom Reference block to work in Magento.
These are the steps I have taken:
Step 1
Created a new “Reference” block in page.xml
<block type="core/text_list" name="newreference" as="newreference"></block>
Step 2
Added a reference to this block in the place I want it to appear in the page (above the footer in 1column.phtml, 2columns-left.phtml, 2columns-right.phtml, 3columns.phtml)
<?php $this->getChildHtml('newreference'); ?>
Step 3
Added a reference to catalog.xml which tells Magento I want to output a template part (specialfooter.phtml) in the ‘newreference’ Reference block on Category pages
<reference name="newreference">
<block type="core/template" name="specialfooter" template="page/html/specialfooter.phtml"></block>
</reference>
Step 4
Created ‘specialfooter.phtml’ in the page/html/ directory with a simple paragraph block to test.
And nothing happens.
The steps I have taken fit with my understanding of how Reference blocks work, but I could be wrong. I'm struggling to find any documentation, official or otherwise, or any previous SO questions which sheds any light on the subject.
I'm using Magento ver. 1.7.0.2.
Any help would be much appreciated.
By using Magento/Cms/Block/Block class with “block_id” arguments, a CMS block can be placed in the layout. Take an example: Create a static block and add it to the top of the page footer. Step 1: Create a static block as footer_top in the admin. Step 3: Clear cache and check the results.
Click Add Content > Default > Block. Select XML and click Choose. In the Name field, enter a name for your block. In the Placement Folder field, choose the folder where the block should be created.
ReferenceBlock: ReferenceBlock is used when we want to use already existing block and want to put our block in that existing block. We use this if we want to add changes to phtml file of that block.
Don't you have forget a echo
? :
<?php echo $this->getChildHtml('newreference'); ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With