CodeIgniter Forums
Organization brick wall - 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: Organization brick wall (/showthread.php?tid=19961)



Organization brick wall - El Forum - 06-23-2009

[eluser]nZac[/eluser]
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?

Nick


Organization brick wall - El Forum - 06-23-2009

[eluser]tonanbarbarian[/eluser]
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


Organization brick wall - El Forum - 06-23-2009

[eluser]umefarooq[/eluser]
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

Code:
$this->load->view(‘header’)

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

Code:
$this->load->view(‘content’)
$this->load->view(‘navbar’)
$this->load->view(‘sidebar’)

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


Organization brick wall - El Forum - 06-24-2009

[eluser]nZac[/eluser]
I will look more into the templateing library, and post any questions. Thanks for your help!