Skip to content

Header and Footer and Menu on every page

World Wide Web Server edited this page Jul 4, 2012 · 23 revisions

Category:Approaches

[b]The Goal:[/b]

You have some content - typically a header and footer, perhaps a menu that maybe lives in a div - and you want to present these items on pretty much every page on your site.

The problem is that you don't want to cut-and-paste that code into each of your views - it's a mess to maintain, and it's not a very elegant approach.

[b]Discussion:[/b]

Broadly speaking there are a handful of approaches to this challenge:

[b]o[/b] Prepare the common view-snippets early on, and display them in one go with the page-specific data using a generic or main view file. [b]o[/b] ... ?

[b]The approaches:[/b]

[b]o[/b] Header and Footer and Menu on every page - jedd - using a master view, and extending MY_Controller, [b]o[/b] Header and Footer and Menu on every page - yournamehere -description of your approach goes here ...

[b][i][color=grey]Need to automatically insert category/subcategory listing here somehow, later - for the moment I'll handcode in the first couple of links[/color][/i][/b]

Clone this wiki locally