0

I am trying to create a new block for footer in page.xml

steps done are

<block type="page/html_newfooter" name="newfooter" as="newfooter" template="page/html/newfooter.phtml"> added in page.xml

copied the Mage/Page/Block/Html/Footer.php to 'local/Mage/Page/Block/Html/' and renamed to 'Newfooter.php' and renamed the class accordingly

<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml"> 

remains untouched in page.xml

the idea is to call two footers in two different layouts

I am calling new footer like following getChildHtml('newfooter') ?> in my new layout

But its not working as expected . In both of my layouts either footer loads or newfooter loads irrespective of the layout i have selected for my pages.

I am refreshing cache every time. so that is not the issue

I think it is cache issue. After clearing cache if i load a page with footer then from there onwards all the pages will load footer. But if i load a page with newfooter then from there onwards all pages will load newfooter

I tried changing the cache_tags value in _construct but not getting the result

1

just override block

Mage/Page/Block/Html/Footer.php

and in your

_construct function add condition

if()//

$this->setTemplate('page/html/footer.phtml')

else

$this->setTemplate('page/html/newfooter.phtml')
  • Will try this. since the template has been set from the layout will this work? – zamil Jul 4 '14 at 4:19
  • it will override the block param from layout. – huzefam Jul 4 '14 at 4:21
  • What condition should i give inside if() condition? – zamil Jul 5 '14 at 7:29
  • it depends where u want to call the newfooter, say for a particular controller action, then put it as Mage::app()->getRequest(), ->getControllerName(); ->getActionName(); – huzefam Jul 5 '14 at 7:33
  • I have 2 layouts, eg layout 1 should load normal footer and layout 2 should load newfooter . is there a method to get the loaded layout name? – zamil Jul 5 '14 at 7:43

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.