Welcome Guest, Not a member yet? Register   Sign In
Design question - One page for the site = one big controller ?
#2

[eluser]RobertSF[/eluser]
Here's how I did it. I also have a header.php and a footer.php in my view folder, but I have the content view load them. I don't load them from the controller. I only load the content view from the controller.

In my controller, I have:
Code:
$this->load->view('content_view');

Then, in my content_view.php file, I have:
Code:
<?php $this->load->view('header'); ?>

<div id='content'>

<h1>Title of Content</h1>

&lt;form method='post' acti&gt;
  (all the form fields)
&lt;/form&gt;

</div>&lt;!-- content --&gt;

&lt;?php $this->load->view('footer'); ?&gt;

So, for the controllers themselves, the best advice I think I got was to make one controller per related purpose. For example, for user authentication, instead of having three controllers for login, register new user, and retrieve lost password, have one controller for users with functions user/login, user/register, user/get_password.


Messages In This Thread
Design question - One page for the site = one big controller ? - by El Forum - 09-23-2013, 11:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB