Welcome Guest, Not a member yet? Register   Sign In
Menu views and dynamic or static menu information needed.
#1

[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?
#2

[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.




Theme © iAndrew 2016 - Forum software by © MyBB