CodeIgniter Forums
noob question - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived General Discussion (
+--- Thread: noob question (/thread-1802.html)

noob question - El Forum - 06-27-2007

Hey there.. noob here.

I am trying to build a 3 level deep url loading a view at each stage.

My controllor for a user dashboard: dash.php
function index() {
                $data = array(
                        'morecontent' => '',

                $content = $this->load->view('dash/index',$data,true);
This gives me

So there is sub section of the dashboard called the account settings

function settings() {
                $data = array(
                        'morecontent' => $this->load->view('dash/settings',array(),true),

                $content = $this->load->view('dash/index',$data,true);
                $this->wrapOutput($content,"Dashboard > Settings","dash");
So above I am loading the settings view into the dash view... and it gives me

So I want to now load a payment view into settings.. and have the final url be

My instinct is to create a function called payment() inside of the settings() function.. sort of like nesting folders in a file strcture... but that is not how CI works.

I need to have 3 or 4 subpages inside of settings, that is inside of dash... How best to accomplish this?

Sorry if it does not make sense.. I am thinking like a file system.. if I want to group pages into categories I just nest the file structure... how does one nest functions in a controllor to created nested url's?

It is important for us to use this 3 level structure as /dash will have many 2nd level pages which in turn have more 3rd level pages. like /dash/profile/bio and /dash/profile/privacy etc.

noob question - El Forum - 06-27-2007

Sorry.. after a few more searches I found it.. Smile

noob question - El Forum - 06-28-2007

Another approach is to use the Modular Separation extensions on the Wiki. Also do a search for modular separation on the forums. This allows you to create a application/modules/ directory structured like so:


You can add any number of modules. Dash could be a base controller (do a search for base controller) and all other controllers could be extended from the base controller, allowing base controller code to be shared by your module controllers. You dashboard could use a master view or template and the modules could be loaded into the master view/template.

You might also want to read more about creating routes in the user guide and do a search on the forum for additional examples, especially examples using regular expressions (regex).