Using jQuery to modify application.master pages in SharePoint

We are using MOSS 2007 (SharePoint) for our intranet. We were recently tasked with supporting branding for several companies on our farm. We quickly realized that application pages (created by a modified application.master) could not serve multiple proprietary templates (other than themes).

I think the correct solution is to keep the default Microsoft branding in the app pages (we already worked on this in dev - no changes to the files hosted on the server).

As a quick solution, however, I thought I could use jQuery to replace one logo, multiple navigation images, and multiple colors in app pages. Basically going from brand A to brand B before the page is fully rendered.

My question is, how bad is this idea? What are the pitfalls associated with this? Considering this is only a temporary solution, should I try?

+2


source to share


2 answers


I think most of your problems can be solved with a good CSS file. In my experience, this is better than javascript as it loads much faster. Keep in mind that SharePoint builds heavy pages (DOM-wise), so jQuery takes a long time to get to $(document).ready

and even longer to work with this DOM size - on IE6 it can take a few seconds, giving the same impression as a slow site or server.
I did a lot of customization for SharePoint with CSS: it might take a few smelly !important

s, but the result is better than javascript.
Also, remember that you can install the CSS file on each site (on the same page where you set the main sub-site page) - this can be used instead of actually creating the master page for each brand.



+3


source


To add to Kobi's answer , you can use the delegate management feature to deploy.

Place a user control under _controltemplates

, for example:

<%@ Control Language="C#" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %>
<SharePoint:CssRegistration name="/_layouts/custom/app.css" runat="server"/>

      



Write a delegate control function (there is element.xml here):

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
 <Control ControlSrc="~/_ControlTemplates/CustomBranding.ascx"
                 Id="AdditionalPageHead" Sequence="1" />
</Elements>

      

Include custom CSS in _layouts/custom/app.css

.

+4


source







All Articles