Welcome Guest, Not a member yet? Register   Sign In
Best Practice for view templates?
#1

[eluser]Unknown[/eluser]
How do I load common page elements with minimal code?

Currently, to keep my content views clean I only put the contents of my page in views, then have a single head and foot.

This is what my controller would call to pull up the add profile page:
Code:
$this->load->view('head', $data);
$this->load->view('volunteers/add_profile.php');
$this->load->view('foot');

I'm just curious if there is a shortcut anywhere for this, or a better way of doing this.

What I don't want is to make views that actually have page layout information in them other than what is directly required for that particular view.

(meaning I don't want header information in the actual add_profile view, because I might want to use that view somewhere else, or I might want to change the header on all of my pages)

I've thought of doing something like this:
Code:
$data['page']='volunteers/add_profile.php';
$this->load->view('template', $data);
Then have the content portion pull in the $page.

Thoughts?


Messages In This Thread
Best Practice for view templates? - by El Forum - 09-29-2009, 09:06 AM
Best Practice for view templates? - by El Forum - 09-29-2009, 09:32 AM
Best Practice for view templates? - by El Forum - 09-29-2009, 09:37 AM
Best Practice for view templates? - by El Forum - 09-30-2009, 02:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB