Welcome Guest, Not a member yet? Register   Sign In
What is the best way to have multiple pages in an application?
#1

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

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

[eluser]laytone[/eluser]
CodeIgniter Rocks!




Theme © iAndrew 2016 - Forum software by © MyBB