How To Create A Footer
We recently had a discussion internally about what the "Best Practice" might be for implementing "Page Footer" type functionality on WSS/Portal pages (well at least the default.aspx ones). I thought it might be useful to summarise some of the ideas we had, and see if anyone else out there had some others.
1. Static Text
If the footer you need to implement is very static, that is you don't expect it to change (ever), then you could simply open up each page requiring one (templates are under <drive>:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\<Locale ID>\*) and with notepad manually add it in. This change would then automatically appear on all ghosted pages based on the template, and any future pages created with that template. There are some support implications, as service packs and new versions may overwrite these files, meaning you will have to re-implement the solution.
Access To SharePoint Properties: No.
Single Point for changes: No - One point for every page type. Any pages based on the template will inherit the change providing they are ghosted.
Allows for future modification: Yes - Providing pages remain ghosted.
2. FrontPage
Along the same lines as the above, however this time done via FrontPage. Any change would have to be done individually, to every page requiring the footer. This process would also unghost the page, the small advantage here is that any change should not be affected by future service packs or version upgrades (this is not a guarantee!)
Access To SharePoint Properties: No.
Single Point for changes: No, each page will need to be maintained individually.
Allows for future modification: Yes - Only via modification by FrontPage.
3. DHTML and Stylesheet
I haven't actually tried this one, but the suggestion here is to create a HTC file containing your footer:myfooter.htc
oDiv.innerHTML = "<table><tr><td>THIS IS MY FOOTER</td></tr></table>";
Then inside a CSS add the following style:
body
{
behavior:url("/_layouts/1033/STYLES/myfooter.htc");
}
Access To SharePoint Properties: No.
Single Point for changes: Yes, this change will automatically appear on *all* pages.
Allows for future modification: Yes, regardless of whether pages are Ghosted or not.
4. Standard Web Part
The first approach involves creating an standard web part, I call it standard, but it could be one of two things:
a) A content Editor web part, modified to suit, then dragged onto the page. (you could even export it and import it once set up right)
b) A custom developed web part that displays some Area/Site properties along with custom text.
Either way they both live inside a Web Part Zone on a Web Part Page. Of course you don't want to have to manually put these on every existing page, then also remember to add it to every additional page you create, so to improve this solution you could:
a) Modify the ONET.XML file for the Area so that whenever an area is created a new Footer Web Part is automatically added to it. I would suggest this is not for the feint hearted, and it does come with some support considerations. (changing the ONET.XML file post deployment is not supported)
b) Write some code to iterate through all the existing Areas/Site adding the web part to pages as it goes.
Access To SharePoint Properties: Yes.
Single Point for changes: No, will need to either manually add the web part, or to add it with code. To appear automatically on new Areas/Sites would need to modify the ONET.XML file.
Allows for future modification: Yes, regardless of whether pages are ghosted or not.
5. Static Web Part
This involves creating a custom web part, just as you normally would, but instead of adding it to a web part zone on a web part page via the OM, or a manual drag and drop, you make a modification to the underlying page template itself. This change will then apply to all ghosted pages based on that template, and all future pages created with that template. Like any web part you can access the SharePoint object model which enables you to make use of area/web properties, and if the footer changes you just need to modify the web part to have that change instantly reflected across all pages.
To insert a static web part you need to do the following:
1. Register the control at the top of the page:
<%@ Register Tagprefix="PageTools" Namespace="Company.WebParts.PageTools" Assembly="Company.WebParts.PageTools" %>
2. Then place the control where you want it to appear on the page:
<table><tr><td>
<PageTools:Footer runat="server"/>
</td></tr></table>
Access To SharePoint Properties: Yes.
Single Point for changes: Yes, once it has been added to relevant page templates.
Allows for future modification: Yes - via modification of the web part.
Comments
- Anonymous
June 17, 2004
Linked - Anonymous
July 29, 2004
The comment has been removed - Anonymous
July 30, 2004
Thanks for posting Alan, certainly beers to you. So this is a more detailed example of option 3 right?