This one is definitely a very useful little trick to know. In this walk-through we'll add a custom link to the global links section of a Master Page.

There are many ways to do this task, we'll be leveraging the MyLinks control in this scenario.
Let's give it a go!
1.) From the 12 Hive navigate to 12/Templates/Control Templates.
2.) Open the MyLinks.ascx Control Template.
You'll notice that this control template is very straight forward, containing mainly a table and a single control (the actual My Links Control). We'll add link to Google in the global site section.
3.) Modify MyLinks.ascx to look as such:
< %@ Control className="MyLinksUserControl" Language="C#" Inherits="Microsoft.SharePoint.Portal.WebControls.MyLinksUserControl,Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" % >
< %@ Register Tagprefix="OSRVWC" Namespace="Microsoft.Office.Server.WebControls" Assembly="Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" % > < %@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" % > < %@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" % >
< table >< tr >
< td class="ms-globallinks" >< SPSWC:MyLinksMenuControl id="MyLinksMenu" runat="server" / >< /td >
< td class="ms-globallinks" >< asp:Literal id="hlMySiteSpacer" runat="server" / >< /td >
< td class="ms-globallinks" >< a href="http://www.Google.com" > google < /a >< /td >
< /tr >< /table >
That's it! Reset IIS and you'll notice a brand new link in the global links section of your masterpage.
You're probably thinking, "Why not hard-code the link into the masterpage?"
That's a good question. In theory everything in WSS 3.0 / MOSS 2007 is based on standard ASP.NET 2.0, so you can very well just hard-code a link into the masterpage or even create your own custom control and add a reference to it by leveraging a delegate control ( http://www.theartofsharepoint.com/2007/05/creating-custom-control-feature.html ). As developers we only need to remember that SharePoint is built from ASP.NET and with that understanding nothing is too much of a leap.
Hope this helps!
~:)
7 comments:
Wow Eric, I have looked all over for a solution such as this. Can't believe its that simple.
Thanks.
AM
How do you make the link appear only for authenticated users?
Why are you directly modifying a System file? This is not recommended as it's not an MS-supported solution.
Hi Eric,
Nice post.
Can you please tell me how to change the existing seperator images(|)to a new image, after "My Site" and "My Links"?
Thanks and Regards,
Yasovardhan.
Arrombilumb
Bb5g
Arrombilumb
rwbd
miley cyrus nude [url=http://www.ipetitions.com/petition/mileycyrus]miley cyrus nude[/url] paris hilton nude [url=http://www.ipetitions.com/petition/parishilt]paris hilton nude[/url] kim kardashian nude [url=http://www.ipetitions.com/petition/kimkardashian45]kim kardashian nude[/url] kim kardashian nude [url=http://www.ipetitions.com/petition/celebst]kim kardashian nude[/url]
Post a Comment