Is there any way to display header and footer in controller method without using


these two lines in a controller method.

I have created one template file for controller method but that template data is not displaying in my controller method.

When I am printing


in controller method then it is printing an empty array.

enter image description here

1 Answer 1


**For getting header& footer,you can try below code:



But,Without $this->loadLayout(); you cannot get header and footer properly.

Better idea to remove content area section from page using $this->getLayout()->getBlock('root')->unsetChild('content');

You can try also below:

public function IndexAction()


Also you can remove breadcrumbs by add $this->getLayout()->getBlock('root')->unsetChild('breadcrumbs');

  • Sorry @Amit but it is not working.
    – vedu
    Feb 17, 2016 at 12:04
  • nothing is working. I have added screenshot of controller method.
    – vedu
    Feb 17, 2016 at 12:13
  • when I add $this->loadLayout(); $this->renderLayout(); these lines then (content displaying in image) is displayed.
    – vedu
    Feb 17, 2016 at 12:18
  • Please check now...
    – Amit Bera
    Feb 17, 2016 at 12:28

Your Answer

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

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