How to brand a SharePoint Portal or Site for best results – Part 3
March 27th, 2006 // 6:03 am @ Amar
I have been a bit slow in posting on this series. Enjoying my holidays and relaxing most of the time
Here is another installment of this series.
I will focus on one very important item of SharePoint branding. AlternateHeader.
You can brand pages from different templates, so as to give different look on sites / areas created from different templates. But what about the pages in /_layouts/1033 directory. These are common for all the templates, and as soon as the user hits any of these pages, they would hit the common pages.
Some of the pages in the _layouts directory have code to support the alternate header functionality.
In the page you will find a code block like this:
<%
string alternateHeader = SPControl.GetContextWeb(Context).AlternateHeader;
if (alternateHeader == null || alternateHeader == “”)
{
%>
<TR>
…… code which is to be used if the alternate header is not defined
…… goes here.
</TR>
<%
}
else
{
Server.Execute(alternateHeader);
}
%>
This is a very nice way to brand these pages to have different look and feel when accessed from different template pages. The page to use as the alternate header, is definied in the onet.xml for the template concerned. Be careful and get this right before you create your site with that template, as it cannot be changed by modifying the template once the site is created. So before you start your sharepoint deployment it is essential that you get your alternate headers definited properly in the onet.xml.
Basically, have an alternate header for each template you have. This will let to assign an alternate header to pages from from templates in a 1:1 relationship.
E.g. Say you have several team sites with different branding, HR Site, Finance Site and Sales Site. You have created 3 templates for these 3 site types. Now your goals is to provide a seamless interface to the user whenever the user is presented any page from the _layouts/1033 directory, like viewlsts.aspx which is presented when the user tried to see the documents & lists in any site, or create.aspx when the user is trying to create a list.
Before you create your HR, Finance or Sales site, you will be creating 3 templates which would deifine the different branding of these 3 sites. It is essential that you plan ahead and assign different alternate headers in the onet.xml of these templates. In the <Project> element you can add the attribute AlternateHeader=”/_layouts/1033/HRAlternateHeader.aspx” in case of the HR Template.
Whenever a user opens a page in _layouts/1033 from a site created with the HR Template, he will see a page rendered with the header logic picked up from the HRAlternateHeader.aspx. This is provided the above code to include alternate header functionality is in that page. Not all pages from _layouts/1033 contain that code which is a bit of a pain. So for pages which do not have that code, you might want to edit them and add code support to use alternate headers if defined.
This will give you maximum flexibility while making good use of the excellent functionality provided by the AlternateHeader element. I will discuss creating and modifying templates in a later post.
For some providing more information on this alternate header functionality, see:
- AlternateHeader magic to style your SharePoint pages by Serge van den Oever [Macaw]
- Using alternate header in ONET.XML by Giles Gregg
Category : SharePoint
Boris
5 years ago
Hallo Amar,
Thank you for the article, I have searched for this info half a year. It is very usefull for us because we run more then one portal on a single server.
I have a question to the creation of portals. By creation of WSS sites I have the abilyti to choose the Theme/Template to use for the creation. By creation of a portal the standard template is used(SPSNHOME I think). How can I change this behavior?
What I want to achive:
Portal based on my own template. So that I don’t have to touch any site in the DB and the hole layout of the portal results from my template(s).
Look forward to your reply.
Boris
Amar Galla
5 years ago
Best option, keep the main portal template (SPS) as it is. Don’t change the name, but you are free to change the lists, html and onet.xml of that SPS template. Make all your changes to that template, and when you are ready, then create a new portal. It will by default pick up the SPS template, ( which you would have customised by now ), and hence essentially you have your own customised template.
Boris
5 years ago
OK,
so I would do it for my first portal. For the second one I have to do the same, havn’t I?
If yes, does the changes on the standard sps tamplate change the sites alredy based on it?
Amar Galla
5 years ago
The SPS template is only applicable for the main root portal. For any team sites, they use the STS template. So for team sites you will need to edit the STS template. And yes, they will reflect the change on all sites already created ( with some limitations like existing lists will not be deleted if they are removed from the onet.xml ). Also if you have edited your site using frontpage then editing template will have no effect.
http://
5 years ago
I know you have to add the AlternateHeader before creating the site, but are you refering to the top-level site or a subsite? I added it,restarted IIS and created a subsite and its not working. Any suggestions?
Project Title=”Fuse Team Web Site” ListDir=”Lists” xmlns:ows=”Microsoft SharePoint” AlternateHeader=â€_layouts/1033/FuseAlternateHeader.aspxâ€
Amar Galla
5 years ago
Hi Michael, is it giving any errors? Remember the alternate header will work only on pages from the _layouts folder when accessed in the context of your site / subsite. Also, when you created your subsite, the template you chose to create that subsite, will define which alternate header will be used.
e.g If you go to you subsite, and click on create to create or documents and lists or site settings, the pages which will follow, will use the alternate header if it found it properly.
Michael Moore
8 months ago
does the sharepoint portal have to say “sharepoint” on the front page?