How to include shared html in a sharepoint 2010 page
Posted on 2011-02-11
I know we should be doing this another way... IE, using Sharepoint's built-in navigation, but the powers that be want custom nav. I'm so ignorant about Sharepoint that I don't even know what search terms to google! So...
I am working on side navigation that's separate from top nav (that does use built-in sp nav). Top Nav has 6 sections. For each section above, there are 10 or so pages that all share the same side nav code.
The page layouts for each of the content pages have a RichHtmlField that we dump static html into for building the navigation. Instead of pasting a chunk of html into every page for every section (60ish pages) and the future hassle of editing each page when the menu changes, I'd like to populate this nav area with html from a single source for each section. Each chunk of code could come from a list or file. So there's be 6 files or 6 list items. Each holds the nav for the 10 pages of a section.
IE, All of section 1's pages would populate their nav section with section 1 nav html. All of section 2's pages would get section 2 nav html, etc.
I tried adding an iFrame pointing to a file for each section, but when the page loads, IE tries to download the html file instead of displaying it.
In the end, I want users to be able to edit each page, set the source file name or list record to grab the html nav code from and be done. Later, if the nav for a section changes, I modify the pertinent list item or file and boom, the nav for 10 pages is updated and we're done.
In other web publishing engines it's easy. In ColdFusion, just do a cfinclude.