How to include shared html in a sharepoint 2010 page

Posted on 2011-02-11
Last Modified: 2012-05-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.
Question by:grayforge
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3

Author Comment

ID: 34876845
BTW, this is using the Publishing Site, if that makes a difference.

LVL 17

Expert Comment

by:Andres Perales
ID: 34879603
You have the option to use Custom navigation with built in SharePoint.

When you go to a site collections site setting > Navigation  you will see the menus options.  The Top Nav bar is Global and the left side navigation is called Quick Launch.

You can add heading and links to both of them and then move them up or down as you need.

If you create a heading and leave out a url then you can create a link beneath it!  To create a sub item.

You can do the same with pages, create a page, and the move it under a heading.

Author Comment

ID: 34879761
Thanks for the input... One of the requirements is that the left nav hilites the currently selected page in the nav list. Does the built-in navigation do this?

IE, if the left nav looks like this:
Page 1
Page 2
Page 3
Page 4

and the user selected page 3, the Page 3 item in the nav would be colored Orange instead of black.

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 17

Expert Comment

by:Andres Perales
ID: 34884384
Does not do it by default, but you can edit the tag for css style as well to make it do that!

Author Comment

ID: 34892556
How would CSS know which page is loaded and so which menu item to hilite?
LVL 17

Expert Comment

by:Andres Perales
ID: 34893271

Accepted Solution

grayforge earned 0 total points
ID: 34897984
I've researched how to hilite a particular menu item using just css and one way is to give the enclosing container of the menu structure a unique ID or class for every page. Then build the css to hilite based on specific enclosing container/list item combinations.

Alas, each page (it's a publishing site) has regions to add content to, but the body tag is set up in the master page. Will Sharepoint do something like this for an out of the box left nav? IE, give me enclosing region/list item combinations I can reference in CSS?

Again, what I'm really looking for is a way to simply include html from a file or list into each page by setting a filename or list ID in the web part/zone or whatever on a page by page level.


Author Closing Comment

ID: 34959182
No solution for including html into a web part/zone added.

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SharePoint 2013 Searchbox Branding 11 173
How to setup workflow manager to work with Sharepoint server? 2 75
SharePoint Foundation 2013 Search 11 100
SharePoint 2013 Table Moves 3 42
For SharePoint sites, particularly public-facing ones, there are times when adding JavaScript, Meta Tags, CSS Styles or other content to the page <head> section is more practical than modifying master pages.  For instance, you could add the jQuery l…
Summary In SharePoint 2010 it is easy to create custom color themes to jazz up a site. Theme colors can also be created in PowerPoint 2010 with a few clicks. But how do the chosen colors actually look in the SharePoint site? The attached PowerPoint…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below.…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question