-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Header and Footer and Menu on every page
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.
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.
- ... ?
- Jedd's take - (summary - a master view, extending with MY_Controller),
- BrianDHall's take - (summary yet to be provided)
- Jérôme Jaglale's take (off-site) Summary - most simple template library
- Chuck Son's take - Hooks
- {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