Welcome Guest, Not a member yet? Register   Sign In
Organization brick wall

Ok I am working on getting my website's shifted over to CI based but I need clarification that I am doing this right.

I have a standard html flow. Header, Nav bar, Content, sidebar and footer. For every page I will need to load all of these views, but only content and sidebar really ever change. Do I have to do: $this->load->view('header') every time in the controller? Or is that the way to do it? Am I over thinking this?


there are various templating libraries that you can use, most included in the forum or the wiki
they allow you to create an overall template and your views just return the content.
for things like header, navbar, sidebars and footers you use what are often referred to as elements
these are view files, often named differently, that contain small sections to be displayed

doing things this way allows for further abstraction of the design so that the template of the site is kept seperate from the content of individual pages

try to load only dynamic content in you template, if you header is static not changing for every page leave it in you template no need to call


every time, i hope you content and menus and side bar are dynamic data is coming from database than you can use


and if you footer is also dynamic then you can carry on.

I will look more into the templateing library, and post any questions. Thanks for your help!

Theme © iAndrew 2016 - Forum software by © MyBB