Portal Alternate Header

July 11, 2004 at 12:13 pm | Posted in SharePoint, SharePoint 2003 | 25 Comments

I received a comment from Sunil on SharePoint customisation, and I decided to make a post of of my reply. It was great to receive a comment, firstly furthering the sharing of knowledge, secondly it's great to know that someone is reading my blog! Hey all you lurkers out there, drop a comment sometime, it's the sort of thing that motivates us to post more information.. πŸ˜‰

anyway, back to the question…

is there any way where I can change the home page of portal server and all following site pages ( not my sites) will have the same. I tried the alternateheader, but I don't know where I made the mistake none of the pages got changed or no changes error happend also. no change.

There are a couple of options available to you with SPS. You can specify an alternate image for the top corner, and an additional CSS stylesheet through the SharePoint administration interface. However it sounds like you want more substantive changes.

WSS sites are created from a single template, either STS or MPS. However SPS sites are made up from multiple templates under the system 60 directory :- SPSBWEB, SPSCOMMU, SPSNEWS, SPSNHOME, etc..

Thus, any changes you make must be made to the ONET.XML file must be made to all the SPS?????/xml/onet.xml files. Additionally, they must be made before you create the portal site.

However, the Portal ONET.XML files already have an alternate header defined, "PortalHeader.aspx" which you can find in the layouts/1033 directory (presuming you are using the 1033 locale). So, you can edit that file to implement changes to the portal header.

Except, no, you can't really.

Without going into great detail on the SharePoint architecture, all sharepoint pages are based on an .aspx template somewhere under the /60/ directory. Some of those templates contain a line of code saying:-

string alternateHeader = SPControl.GetContextWeb(Context).AlternateHeader;
if (alternateHeader == null || alternateHeader == "")

Pages that contain this statement will show any changes that you make to PortalHeader.aspx. Pages that don't, won't. Unfortunetly the only pages that have this statement are admin pages under the layouts/1033 directory. Even then, its not all of them.

Pages that the end user sees run under a different architechure to the administration pages. So how do you edit the header on these pages? So far, the only method I am aware of is to edit every single template file. There are about 100 per language for STS sites (web part page and list templates), I haven't worked out how many for portal sites, as I'd rather not even think about it. The most managable solution I have found is to use a javascript include that manipulates the DOM client-side at run-time, but this is only suitable for minor edits.

Anyone who has found how to use an alternate header properly across all pages, please raise your hand. Much kudos is available to whoever can draw the sword of customisation from the stone of SharePoint.



RSS feed for comments on this post. TrackBack URI

  1. Thanks Giles,

    You are right, I did a search almost all resources available in the net as well as almost all aspx pages in SharePoint site to find is there is any other way around. I believe Microsoft is suggesting us to satisfy with what ever you can do with CSS.

    Any way I believe I may have to change many of pages with my new header manually ( or may be using some find and replace using regexp ) let me think on that lines now.


  2. From a portal perspective, what about including the alternate header code:

    string alternateHeader = SPControl.GetContextWeb(Context).AlternateHeader;
    if (alternateHeader == null || alternateHeader == “”)

    in each of the user pages in a site definition? After that’s done, copy all of these pages to a new site definition as needed. It’s not perfect, but it would probably cut down on the amount of customization you would have to do. Then, the only other set of pages you would have to modify manually would be the Home area of an SPS site.

    What do you think? I’m going to take this approach and I’ll make sure to post my findings.

  3. I might have tried this, I can’t remember… my concerns would be:-

    The SPControl object might not be accessable from these pages, but should be.

    Since the pages do not currently use this method, it would probably not stop SharePoint from still writing out it’s own header, as well as including your own…

    Adding <% %> brackets to a dynamic page is interpreted as a security risk by FrontPage 2003.

    Perhaps you can find a way around these issues. I am still relying on using client-side javascript in all the templates.. I can edit the javascript file which is refered by all pages..

    Actually, you’ve just given me an idea for server-side modification… will research..

  4. Any updates? I have been reading this with some interest as I am currently in the process of changing ALL templates. It is being done MANUALLY.

    What year is this Micro$oft? They have dynamic includes in EVERY template but there is no easy way to add your own for commonly used header/footer across all pages?! This must be some kind of bad joke.

    I have not tried the client side javascript and don’t really know if that’s such a good solution. I would like to drop in some code to permit a standard header /footer across ALL pages. I have also been putting in a fair amt of work to get the portal to behave just like the WSS sites.

    The sites are easy, it’s customizing all those list files that is such a nightmare. It’s just so hard to believe that they have copied and pasted almost identical static code into so many templates. Makes it near impossible to customize.

  5. No update at the moment, the advice I would give at the moment is to use a strategy that:-

    a) would not be completely overwritten by a MS patch to sharepoint .aspx template pages.
    b) does use search and replace.

  6. Here is the problem guys.

    I edit the PortalHeader.aspx and add my code to the header. When I try to create a portal, the creatiion process fails. I doesn’t matter if my change is a space or even a hard return, it is failing. I replace the file and same problem persists. I have to uninstall and reinstall sharepoint to fix it. I am new to sharepoint, so I do not know all the workings of the application. If any one has any ideas they can shoot toward me.

  7. You have edited the portalheader.aspx file, and found you now have an error when creating a portal? If you have returned the portalheader file to it’s orginial state and restarted iis, then that should resolve the problem.

    If you are still having portal creation problems then I would suggest that something else is causing problems.

    SharePoint is a complicated combination of technologies, so do consider any other changes you have made.

    Good luck!

  8. Approach I have taken is using a HttpModule to do replacements on the HTML output generated by SharePoint just before it is sent to the browser. Have a look at http://www.gotdotnet.com/workspaces/workspace.aspx?id=3ed68681-ae28-4d33-8c36-403e6af7fa11. Sample configuration file contains a commented out section for a situation where you want to give different area’s different styles.. Please let me know if it works for you… Also havea look at my weblog at http://weblogs.asp.net/soever

  9. Giles,
    maybe you can help me with a problem related to the Page header from a different point of view:
    In case of access restrictions I receive the reqacc.aspx page with an empty header .
    As I track the code I assume the portalHeader.aspx executed and the “SPSWC:PORTALHEADER…” rendered empty code.
    Are you familiar with such a problem?
    What can be done?
    Many thanks

  10. Will this work with WSS also?

    I am getting ready to start modifing the WSS templates, getting rid of the links to the Admin page. (Come on Microsoft…get it together. Readers may not have access to do anything, but, just the fact that they can see all the things I can do…) Sorry, no more gripes.

    Are there any new strategies for this?

  11. Hi..

    I have a Portas say “amit.wss.com” and I want to change it to “vasu.wss.com”.

    How can I do that.



  12. Well i have spent the last 2 days searching a way to replace and brand portal headers in pages like spnewlisting.aspx and this blog post it is the cruel reality.

    I give up. i will try to do branding modifications by manually (where i can…).
    If someone tried the HTTPModule trick and there is good results, please leave a comment.

    Best regards.

  13. I have customized a portal using a custom CSS and am looking to customize the areas/subareas below the Portal to reflect the Parent/subsidary company intranets – In reading the various sites I have come across references to the alternateCSS. Is there any value in pursuing this function?

  14. Using alternateCSS? I presume you wish different areas to have different stylesheets?

    I’m afraid this question (if I’ve understood it) reveals another boo-boo in SharePoint, only one style sheet per portal.

    The only easy way to do what you suggest is to have either a control that you embed in to every page that writes out a stylesheet url using rules that you control, or have a customised area template per stylesheet.

    No easy one on this either…

  15. have you guys tried this microsoft tutorial:


    I have gotten it to work for my home page and sub sites.


  16. I tried that Microsoft tutorial to customize the header and all of the pages worked fine accept for the Topics. The page errors out now. I copied and pasted the same header in the topics page as the rest but for some reason it errors out.

  17. I have been trying to implement a global design banner change to my SPS site and after fiddling around for a long long long time I finally got it all working. If anyone ever needs to go down that path.

    1. Follow the steps in http://msdn.microsoft.com/office/understanding/sharepoint/default.aspx?pull=/library/en-us/odc_sp2003_ta/html/office_sharepointhowtoapplybrand.asp – “Applying a Custom Banner”. The following is the various folders that exist in Program FilesCommon FilesMicrosoft Sharedweb server extensions60TEMPLATE1033 where you need to update the default.aspx and which sections they control.
    SPS Home
    SPSBWEB To create bucket Web sites
    SPSCOMMU Communities
    SPSMSITE Site Registry
    SPSNEWS Subareas under News
    SPSNHOME News Home
    SPSPERS MySite
    SPSTOC Topics Home
    SPSTOPIC Topic
    STS WSS Sites

    Contrary to the MS article all these changes update are the Area Home Pages, Site Summary Page and Search Pages.

    2. The content pages still have the default template and you need to manually update each of the following files
    editform.aspx and

    for each of the following content areas

    for each of the relevant areas in 1. Meaning if you want to update the Document Library pages within any section that uses the Home Template you need to update the 4 aspx files in 1033SPSLISTSDOCLIB. Similarly if you want to update the Survey pages in a section that uses the News Template you need to update the 4 aspx files in 1033SPSNEWSLISTSVOTING. etc etc etc

    3. To update all the admin pages you need to update PortalHeader.aspx in Program FilesCommon FilesMicrosoft Sharedweb server extensions60TEMPLATELAYOUTS1033. Make sure you keep all the SPSWC line and then add your design changes following it.

    So about 18 hours later you’re all done. What I also did find out is that in theory all SPS sites are built off ONET.XML contained in the relevant /SPS??/XML folder. However you need to make the changes to the ONET.XML file BEFORE creating the Portal Site. However if you update the ONET.XML file then SPS doesn’t create the portal site and returns an error.

    Also most of the admin pages have the following tag

    string alternateHeader = SPControl.GetContextWeb(Context).AlternateHeader;
    if (alternateHeader == null || alternateHeader == “”)

    which is why any changes made to PortalHeader.aspx in 3. above affects all admin pages. An idea would be to include this tag in all the user aspx pages so while you still need to initially update all pages manually, all subsequent changes only need to be made to one file.

    Finally, if you update any page on SPS using Frontpage 2003 you can then no longer update it directly via the file system. For example if I update the SPS home page using Front Page, then any subsequent changes I make to 1033SPSdefault.aspx will no longer be valid and won’t feed through to the user. Apparantly FP2K3 creates a copy of the file and then you are royally f***ed.

  18. Err
    try creating your own site defnition registring Tag prefixes for custom writen navigation/ bread crumb trails and search web parts –
    Then set the default ‘sub area’ template to your newly created site definition
    modify the css’s adding your own tags where needed (for custom written apps)

    deploy and voila

    try it – i did πŸ™‚

  19. Thanks to all that posted. Great read and I feel better knowing others are also wrestling with the SPS beast as I currently am.

    Customisation should be much much simpler than the brain surgeon approach that is currently available. Period.

    Once again thanks for all the useful tips and tricks and a great blog.

    South Africa

  20. Banner customisation seems to require updating many many files (especially lists)
    with the new custom logo.

    I am not aware of any microsoft tools to do pattern matching and
    substitution while walking the directory tree and updating all required files. What tools/approach do you use to accomplish this mammoth task without manually having to editing each file?

    Closest I have come to do this is to install Active Perl and run a fairly complex regular expression
    script to substitute text in multiple files and sub directories.

    Can post perl code if anyone interrested.

  21. Wow!, just spent 2 days researching the Macaw SharePoint Skinner tool… located here:


    It rocks!
    It allows you to modify the html after sharepoint renders it, but before it is sent to the client browser. Which allows me to slice and dice anything!

    I have strong regular expression experience, which helped a lot.

    I use this tool to do some seriously advanced customisations to SPS such as:

    -Custom logo on ALL pages
    -Custom styles in portal area
    -I move a 3rd party navigation webpart’s html into the quicklaunch bar of all teamsites
    for that much desired left had navigation standard web site look and feel.

    -The best bit is you do NOT need to modify 10,000 files, but only one xml configuration file that comes with the skin tool.

    This is a seriously useful tool.
    Check it out if you have bald spots from trying to customise SPS site defs!

    South Africa

  22. This is horrible. The great Microsoft is incompetent when it comes to SPS. What amazes me is that they actually allow a product like this to be such a mess.

    Then again, when I found out Frontpage was the tool of choice it was obviously a screw up.

    I’ve been working on this for a month now and I’m so frustrated by Sharepoint that I would not recommend anyone attempting to use it – there are better solutions that are more managable.

  23. This is utter rubbish! wake up microsoft! I’ve got a client who wants a custom header and a huge sharepoint site where i can’t sit and waste my time editing each page. anyone know the dangers of editing each page in frontpage?

    Konrad, does the skinner work?

    Courtenay, South Africa

  24. Please, do a google search on the Dangers of Frontpage, Sharepoint, and the effect unghosting a page has on a site.
    If you have an enterprise website, DO NOT use FrontPage! Use another editor.
    The Best way to edit pages is on your sharepoint server. Look up the “right” way on http://msdn.microsoft.com/library/default.asp. Expand “web development”, then “server Technologies”, then “sharepoint Products and Technologies”, then “Sharepoint Products and Technologies (2003)”, then “Technical Articles”. Open the articles that start with “Customizing…”.
    Following these methods will save you some MAJOR headaches in the future.

  25. I used the same alternateHeader checking(if it is null or “”) in all custom pages within my site defintion(like Allitems.aspx,upload.aspx,etc) and Server.Execute fails on me with this Error “Error executing child request for….”. I kept the alternateHeader checking and replaced Server.Execute with Response.Write(“WriteBanner()”);
    WriteBanner() is a function in a java script file that is used in my CustomHeader.aspx too.it is not the ideal way ,but works fine for me.–>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: