Best practice creating dynamic sidebar with zend framework

后端 未结 4 2056
情深已故
情深已故 2021-02-03 15:09

What is best practice to create dynamic sidebar or other non content layout places with zend framework. At this moment I created controller witch i called WidgetsController. In

4条回答
  •  盖世英雄少女心
    2021-02-03 16:06

    We'd like some more details, i.e what sort of content is shown in the sidebars, how you show them (i.e using a

      ,
      or something else), is the content retrieved from a database, etc.

      In CodeIgniter which also uses the Model, View, Controller format, we create a view called 'sidebar.php' and in the Header view, we include a call to this sidebar view, i.e:

      
      .......
      
      load->view('sidebar');?>
      

      The sidebar view contains the logic for showing the menu items. Usually it is a static menu, but if it was dynamic and had to be fetched from the database, I would do this:

        some_model->getMenuItems(); foreach ($items as $item): ?>

    提交回复
热议问题