Welcome Guest, Not a member yet? Register   Sign In
Setting up a dynamic menu in CI
#1

[eluser]Ben Edmunds[/eluser]
First off, hello to everyone here. I am looking into CodeIgniter and I really like what I see.

There is something I am trying to figure out how to do with CodeIgniter and I need some help.

How would I setup a layout file with a header, footer, dynamic menu, and the normal view content?

For example:

Code:
<html>
<head>
<!--scripts go here-->
</head>
<body>
<div id='banner'></div>
<div id='menu'>&lt;?php $this->layout()->menu ?&gt;</div>
<div id='container'>&lt;?php $this->layout()->content ?&gt;</div>
<div id='ads'>&lt;?php $this->layout()->other ?&gt;
<div id='footer'>blah</div>
&lt;/body&gt;
&lt;/html&gt;

I do not want to break the MVC pattern though. So I want to have a controller for the menu that access a model and then a menu view to display the menu.

This is possible in Zend but the method is pretty bad IMHO and symfony can do this perfectly with components but I don't see anything comparable in CI? Symfony seems really bloated and slow, plus I don't like the ORMs so I don't want to use Symfony.

I saw the nested views in the FAQ but I still don't see how to accomplish it in an MVC pattern...

I think Symfony style components are the best way I've see of how to accomplish this but maybe there is something better?

How do you guys do this on your sites? Surely you don't put your menu into each controller, and do you keep the MVC pattern for your menu and other dynamic content that must be on every page?


Thank you in advance,
-Ben


Messages In This Thread
Setting up a dynamic menu in CI - by El Forum - 07-25-2009, 10:20 PM
Setting up a dynamic menu in CI - by El Forum - 07-26-2009, 05:50 AM
Setting up a dynamic menu in CI - by El Forum - 07-26-2009, 05:57 AM
Setting up a dynamic menu in CI - by El Forum - 07-26-2009, 06:00 AM
Setting up a dynamic menu in CI - by El Forum - 07-26-2009, 06:17 AM
Setting up a dynamic menu in CI - by El Forum - 07-26-2009, 06:40 AM
Setting up a dynamic menu in CI - by El Forum - 07-26-2009, 09:48 AM
Setting up a dynamic menu in CI - by El Forum - 07-26-2009, 11:49 AM
Setting up a dynamic menu in CI - by El Forum - 07-26-2009, 09:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB