Ad

How To Implement A Sidebar In Zend Framework

- 1 answer

How do I implement a sidebar in Zend Framework? I know that I can use a placeholder or something similar in Zend_layout, but how do I automatically generate the code for the sidebar in my controllers without having to call a sidebar class within every controller? My setup is as follows

Application
- modules
  - blog
  - other modules

I only want the sidebar for my blog module.

I have found this http://www.zfforums.com/zend-framework-components-13/model-view-controller-mvc-21/how-layout-sidebar-etc-2677.html but I do not understand the last part "just inject your layout, register it with the front controller ..."

Ad

Answer

You could just have a action and view in one of your controllers which renders the sidebar.

from the layout for the blog module you just call:

<? echo $this->action('action','controller','module',array('optionalparams'=>1); ?>

on the position where you want to have it. So one call to one action.

Ad
source: stackoverflow.com
Ad