How would you structure the below page in Codeigniter?
I thought about creating seperate controllers for each section
- Left nav
- Content nav
- Login name
- Leaderboard
Excluding the content section (as this changes depending on the link on the left nav and content nav used as a kinda sub-menu). All the other sections remain roughly the same
I thought about doing:
Class User_Profile extends Controller
{
function index()
{
$this->load_controller('Left_Nav');
$this->load_controller('Content_Nav');
$this->load_controller('Login_Name');
$this->load_controller('Leaderboard', 'Board');
$this->Left_Nav->index(array('highlight_selected_page' => 'blah'));
$this->load('User');
$content_data = $this->User->get_profile_details();
$this->view->load('content', $content_data);
$this->Login_Name->index();
$this->Board->index();
}
}
Obviously this load_controller
does not exist but this functionaility would be useful. The controller for each section gets the data required from the model and then loads the page through $this->view->load()
It could be a headache to have this code in all the left nav links like News, Users, About Us, etc.. But then again not every nav link has all those sections so I need that flexability of having the sections as a "partial view"
Can anyone suggest a better way of doing this?