CodeIgniter Forums
How do you structure your code? - 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: How do you structure your code? (/showthread.php?tid=15142)



How do you structure your code? - El Forum - 01-27-2009

[eluser]ryeguy[/eluser]
CodeIgniter is great in practice, but I'm running into difficulty using it for an actual site. I have a small login box on the left navigation bar that is made in CI, but the rest of the page is normal HTML. Where would I put the code for these controller wise? My main controller is called Accounts (as this is what I am mostly using it for), but it seems stupid to make stuff like Accounts/about_us, Accounts/what_do_we_do, etc. What I do is I have a function called _login_form which fills an array with variables I pass to the view to render the login form. For the regular pages, all I end up doing is something like:
Code:
function about_us()
{
    $this->load->view('about_us', $this->_login_form());
}

It just seems kind of out of place when I have about_us inside of the Accounts controller. Do most people just create a Nav controller or something?


How do you structure your code? - El Forum - 01-27-2009

[eluser]Rey Philip Regis[/eluser]
I really don't get the your question? What's the connection between your login and the Accounts/about_us?


How do you structure your code? - El Forum - 01-27-2009

[eluser]ryeguy[/eluser]
There is none - that's my point. I need to use a controller because I have a login box on the side of every page, but that's it.


How do you structure your code? - El Forum - 01-27-2009

[eluser]Rey Philip Regis[/eluser]
can you post the code?