CodeIgniter Forums
What is the best way to have multiple pages in an application? - 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: What is the best way to have multiple pages in an application? (/showthread.php?tid=27684)



What is the best way to have multiple pages in an application? - El Forum - 02-17-2010

[eluser]igniteflow[/eluser]
Hi, apologies if this is a noobish question. I am finding CodeIgniter easy to get into due to the great documentation, and am able implement quite a lot of it's functionality now on a single page. My question is I've just added a second page to my application by adding a new controller and a new view file, which works, but I have a feeling there might be a more efficient way of adding more pages? Can I do this from within a single controller?

I am accessing the new page, called stories, with the following URL:

http://www.example.com/index.php/stories

(controller: stories.php / view: stories_view.php)

Hope I've explained this sufficiently, let me know if I haven't


What is the best way to have multiple pages in an application? - El Forum - 02-17-2010

[eluser]igniteflow[/eluser]
Think I've just found the answer actually, please correct me if I'm wrong/there's a better way. I moved the index function of the controller stories.php into the main contoller welcome.php and called it stories(). I then changed the URL to call it to:

http://www.example.com/index.php/welcome/stories

and it worked as requested, thus eliminating the need for a second controller.


What is the best way to have multiple pages in an application? - El Forum - 02-17-2010

[eluser]laytone[/eluser]
CodeIgniter Rocks!