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.

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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?

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

Independent Software Vendors: 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!

Question has a verified solution.

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

The vision: A MegaMenu for a SharePoint portal home page The mission: Make it easy to maintain. Allow rich content and sub headers as well as standard links. Factor in frequent changes without involving developers or a lengthy Dev/Test/Prod rel…
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

631 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