Part of the EllisLab Network
x
 
Create New Page
 View Previous Changes    ( Last updated by jedd )

Header and Footer and Menu on every page

Category:Approaches

The Goal

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.


Discussion

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

o  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.
o  ... ?

 

The approaches

o  Jedd’s take - (summary - a master view, extending with MY_Controller),
o  BrianDHall’s take - (summary yet to be provided)
o  Jérôme Jaglale’s take (off-site)  Summary - most simple template library
o  Chuck Son’s take - Hooks
o Your CI login-name goes here’s take - summary of your approach goes here - COPY-THIS-LINE-WHEN-ADDING-YOURS

Note to would-be contributors - it’d be just fantastic if you’d spend the time sharing your approaches with the world, but please resist the temptation to provide a link to another site.  First, sites come and go, and dead links are a real pain in the proverbial.  Second, off-site material doesn’t get discovered by searches within the wiki.  Third, the world has enough web pages that are ‘lists of links’ - we don’t need to add to the collection.  And finally - the whole idea of this collection of Approaches is so that users can see what you do - so can you please put your name on anything you contribute, so people can PM you if they want to clarify something?


Need to automatically insert category/subcategory listing here somehow, later - for the moment I’ll handcode in the first couple of links

Categories: