Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


How to include shared html in a sharepoint 2010 page

Posted on 2011-02-11
Medium Priority
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.

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

There is one common problem that all we SharePoint developers share: custom solution deployment. This topic can't be covered fully in this short article, so all I want to do in this one is to review it from a development-to-operations perspectiv…
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...
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

722 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