Question

Working with Magento CE 1.9.1.0.

I have written some custom code which I have placed here:

app/design/frontend/mypackage/mytheme/template/page/html/custom_code.phtml

I also created a new XML reference to this file here:

app/design/frontend/mypackage/mytheme/layout/page.xml

This is the reference I added within the layout block:

<cms_index_index>
  <reference name="before_body_end">
      <block type="core/template"  name="my_custom_code" template="template/page/html/custom_code.phtml" />
  </reference>     
</cms_index_index>

However after clearing cache and verifying there are no errors anywhere on the system, I still can't get the block to show before_body_end anywhere on the homepage. What am I doing wrong?

Was it helpful?

Solution

The template location is wrong.

Assume that your template is located at app/design/frontend/Your_Pakage/Your_Theme/template/page/html/custom_code.phtml.

Magento,design fall back logic it would be automatically at app/design/frontend/Your_Pakage/Your_Theme/template/.

So you need just add page/html/custom_code.phtml instead of template/page/html/custom_code.phtml.

Use template="page/html/custom_code.phtml" instead of template="template/page/html/custom_code.phtml"

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top