Welcome Guest, Not a member yet? Register   Sign In
Simple Navigation Menu
#1

[eluser]Mondal[/eluser]
I am a newbie with codeigniter. I am trying to write an application using mysql database. In my site I want to use menu as :

+Homepage
+About
+Services
+Education services
+neurofeedback
+biofeedback

I need some information to understand. I use pages controller as main pages controller:

<?php

class Pages extends CI_Controller {

public function view($page = 'home')
{$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);

my questions are :

1) where the menu controller must be coded inside pages controller or seperate one?

2) how can i make the menu controller from database ?

3) How can i make relation with the menu id and the page id?

I made lots of research but i need a little bit more clear understanding .
Please..
Thank you for your help.
#2

[eluser]Otemu[/eluser]
1. I would use https://bitbucket.org/wiredesignz/codeig...ions-hmvc/ this way you can drop the menu as a module, the menu will have its own controller, view and model.

I would then setup a master template page, there are many techniques you can use to achieve this, the template page would load your common elements such as page header, footer, etc so you don't need to load it every time in each of your views for every layout. A popular template system is http://getsparks.org/packages/template/show, you can then load various different layouts within the template without having to load your header and footer every time.

2. To achieve such a menu structure from the database most common methods to use are The Adjacency List Model and Nested Set Model. Check out this excellent article http://mikehillyer.com/articles/managing...-in-mysql/

3. If you looked at the techniques in step two then your need to relate the categories table to your page table. if a user navigates to yoursite.com/Services/biofeedback a query would run on the categories table and get the related page in your pages table.

If your menu is rarely/never going to change you might find it more simpler just to use a static menu which would save you a lot of time.
If your not to concerned with categories you could just use a unique url and query the database that way

This is quite a brief explanation so feel free to ask more questions and I try help you best I can

#3

[eluser]Mondal[/eluser]
Thanks. but i am new in codeigniter.
So please give me some easy tutorial and concept.
Please help me...
Thanks
#4

[eluser]Otemu[/eluser]
Check out http://net.tutsplus.com/tutorials/php/co...tch-day-1/




Theme © iAndrew 2016 - Forum software by © MyBB