CodeIgniter Forums
Menu views and dynamic or static menu information needed. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Menu views and dynamic or static menu information needed. (/showthread.php?tid=53624)



Menu views and dynamic or static menu information needed. - El Forum - 07-31-2012

[eluser]ytsejam[/eluser]
Hello ,
I am a newbie with CI. I want to write an application with a sidebar menu and information gathered from mysql database. I want to learn that which is better if menu items wont change much static or dynamic menu.

The other problem is that , I use pages controller to show pages
Code:
<?php

class Pages extends CI_Controller {

  public function view($page = 'home')
  {
    
   if ( ! file_exists('application/views/pages/'.$page.'.php'))
   {
    // Whoops, we don't have a page for that!
    show_404();
   }
  
   $data['title'] = ucfirst($page); // Capitalize the first letter
  
   $this->load->view('templates/header', $data);
   $this->load->view('pages/'.$page, $data);
   $this->load->view('templates/footer', $data);

  }
This is the menu I want :
Code:
+homepage
+about
+services
  +education
  +biofeedback
Where shall i put the menu controller ? If i use a seperate menu controller , how can i make it shown after header?


Menu views and dynamic or static menu information needed. - El Forum - 07-31-2012

[eluser]astroanu[/eluser]
what i do is use a different view file and load it using
Code:
$this->load->view('menu');
. or use a function to return the menu. so all you need to do it edit the links and text for the menu in a single place.