Skip to content

Header and Footer and Menu on every page

fernanfs edited this page Sep 30, 2012 · 24 revisions

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:

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

The approaches

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

Clone this wiki locally