What if you have a base page layout class or master page, eg. MyBasePageLayout, MyBaseMasterPage.
Then you override the Render method. On overriding it you look for the text "~siteCollection/" then you replace that with the actual URL? ________________________________ From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Paul Noone [EMAIL PROTECTED] Sent: Tuesday, 23 September 2008 7:03 AM To: [email protected] Subject: RE: [OzMOSS] RE: Using static tokens for URLs within Layout Pages Hi Sezai, Your suggestion works to a point but because this particular URL contains two instances of the domain root I’m still unable to get it to work. I have tried: <% $SPUrl:~SiteCollection/SitesList/NewForm.aspx?Source=~SiteCollection%2FSiteDirectory%2FPages%2Fcategory%2Easpx%> <% $SPUrl:~SiteCollection/SitesList/NewForm.aspx?Source=%><% $SPUrl:~SiteCollection%2FSiteDirectory%2FPages%2Fcategory%2Easpx%> <% $SPUrl:~SiteCollection/SitesList/NewForm.aspx?Source= & $SPUrl:~SiteCollection%2FSiteDirectory%2FPages%2Fcategory%2Easpx%> In all cases the second instance gets printed literally. Is it a limitation of the token that it is only recognised the first time? Is there a simple way to concatenate these? I can’t believe I’m the only one who has a burning need to use a dynamic site root in common hyperlinks on Layout Pages. What are other people doing to achieve this? Regards, Paul Online Developer, ICT CEO Sydney From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of sezai komur Sent: Monday, 22 September 2008 2:54 PM To: [email protected] Subject: Re: [OzMOSS] RE: Using static tokens for URLs within Layout Pages Try this Paul - <a href="<% $SPUrl:~SiteCollection/test %>" runat="server">Intranet</a> Seems to work for me. Got the idea from ArticleLinks.aspx which contains the following in the PlaceHolderAdditionalPageHead Content Placeholder : <asp:Content ContentPlaceholderID="PlaceHolderAdditionalPageHead" runat="server"> <PublishingWebControls:editmodepanel runat="server" id="editmodestyles"> <!-- Styles for edit mode only--> <SharePointWebControls:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/~language/Core Styles/zz2_editMode.css %>" runat="server"/> </PublishingWebControls:editmodepanel> <SharePointWebControls:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/~language/Core Styles/rca.css %>" runat="server"/> <SharePointWebControls:FieldValue id="PageStylesField" FieldName="HeaderStyleDefinitions" runat="server"/> </asp:Content> On Mon, Sep 22, 2008 at 9:39 AM, Paul Noone <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>> wrote: Sorry, guys. I hate to bug but have tested this extensively and this solution simply isn't work for me. Maybe it's because I'm trying to use it in a Layout Page? When I use the token on its own it seems to work just fine. But as soon as I append a path to it the token gets printed literally as seen below. This: <a href="<% $SPUrl:~SiteCollection/ %>test" runat="server">Intranet</a> Produces this: http://moss/SiteDirectory/Pages/%3C%%20$SPUrl:~SiteCollection/%20%%3Etest<http://moss/SiteDirectory/Pages/%3C%25%20$SPUrl:~SiteCollection/%20%25%3Etest> Instead of this: http://moss/test Please tell me I'm just doing something stupid and this can be easily resolved. Thanks, Paul -----Original Message----- From: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]> [mailto:[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>] On Behalf Of Jeremy Thake Sent: Tuesday, 16 September 2008 4:25 PM To: [email protected] Subject: [OzMOSS] RE: Using static tokens for URLs within Layout Pages Found this: http://theotherscott.blogspot.com/2008/03/sharepoint-link-to-top-of-site.html Cheers, Jeremy Thake Readify | Senior Consultant Perth | WA 6005 | Australia M: +61 400 767 022 | E: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]> | W: www.readify.net<http://www.readify.net> | B: www.made4the.net<http://www.made4the.net> ________________________________________ From: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>] On Behalf Of Paul Noone [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>] Sent: Tuesday, 16 September 2008 12:06 PM To: [email protected] Subject: [OzMOSS] RE: Using static tokens for URLs within Layout Pages Hi Brian, Adding the missing tag prefixes and using the link code provided produces the following error: An error occurred during the processing of /_catalogs/masterpage/CEO-SiteDirectory-tabs.aspx. Literal expressions like '<% $SPUrl:~sitecollection %>' are not allowed. Use <asp:Literal runat="server" Text="<%$SPUrl:~sitecollection%>" /> instead. If I add the runat="server" attribute to the link tag it produces literal strings. Same goes if I use the suggested ASP literal tags above. Any other suggestions as to why it's not getting translated? Regards, Paul From: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]> [mailto:[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>] On Behalf Of Brian Farnhill Sent: Tuesday, 16 September 2008 1:13 PM To: [email protected] Subject: [OzMOSS] RE: Using static tokens for URLs within Layout Pages Have you tried something like this: <a href="<% $SPUrl:~sitecollection%>/SiteDirectory/SitesList/NewForm.aspx?Source=<% $SPUrl:~sitecollection%>%2FSiteDirectory%2FPages%2Fcategory%2Easpx">Add Site</a> You will need to reference the following in your page though for this to work: 1: <%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0<http://12.0.0.0>, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 2: <%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0<http://12.0.0.0>, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 3: <%@ Register TagPrefix="PublishingVariations" TagName="VariationsLabelMenu" src="~/_controltemplates/VariationsLabelMenu.ascx" %> 4: <%@ Register Tagprefix="PublishingConsole" TagName="Console" src="~/_controltemplates/PublishingConsole.ascx" %> 5: <%@ Register TagPrefix="PublishingSiteAction" TagName="SiteActionMenu" src="~/_controltemplates/PublishingActionMenu.ascx" %> I had a post on my blog about this as well - it's at http://pointstoshare.spaces.live.com/blog/cns!AEC42F315B4528B0!2911.entry Brian Farnhill Consultant Technical Consulting Direct: 02 6225 4307 Main: 02 6225 4333 Mobile: 0408 289 303 Fax: 02 6225 4334 Email: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]><mailto:[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>> Web: www.uniqueworld.net<http://www.uniqueworld.net><http://www.uniqueworld.net> Blog: pointstoshare.spaces.live.com<http://pointstoshare.spaces.live.com><http://pointstoshare.spaces.live.com/> Microsoft Certified Application Developer [cid:[email protected]] From: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]> [mailto:[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>] On Behalf Of Paul Noone Sent: Tuesday, 16 September 2008 12:32 PM To: [email protected] Subject: [OzMOSS] Using static tokens for URLs within Layout Pages Does anyone know if it's possible to use the ~sitecollection and ~site tokens within the content placeholder of a Layout Page in order to provide dynamic URLs at run-time? We are providing some custom elements within the pages and I'm trying to avoid having to update the absolute URLs when we move to production. e.g. <asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server"> <div class="ms-globalright ms-toolbarContainer"> <a href="~sitecollection/SiteDirectory/SitesList/NewForm.aspx?Source=~sitecollection%2FSiteDirectory%2FPages%2Fcategory%2Easpx">Add Site</a> </div> ... Kind regards, Paul ________________________________ ____________________________________________________________________________ This e-mail is intended for the use of the addressed recipient(s) only and may contain confidential and privileged information. If you have received this message in error, please delete the message and any attachments and copies immediately; and notify the sender by return e-mail. Any views expressed in this message or any attachments are those of the individual sender and do not necessarily represent the corporate opinion of the Catholic Education Office (CEO), Sydney. The CEO Privacy Policy is located at http://www.ceo.syd.catholic.edu.au ____________________________________________________________________________ ------------------------------------------------------------------- OzMOSS.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com<http://mailenable.com> ------------------------------------------------------------------- OzMOSS.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com<http://mailenable.com> ________________________________ ____________________________________________________________________________ This e-mail is intended for the use of the addressed recipient(s) only and may contain confidential and privileged information. If you have received this message in error, please delete the message and any attachments and copies immediately; and notify the sender by return e-mail. Any views expressed in this message or any attachments are those of the individual sender and do not necessarily represent the corporate opinion of the Catholic Education Office (CEO), Sydney. The CEO Privacy Policy is located at http://www.ceo.syd.catholic.edu.au ____________________________________________________________________________ ------------------------------------------------------------------- OzMOSS.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com<http://mailenable.com> ------------------------------------------------------------------- OzMOSS.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com<http://mailenable.com> ------------------------------------------------------------------- OzMOSS.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com<http://mailenable.com> ------------------------------------------------------------------- OzMOSS.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com ------------------------------------------------------------------- OzMOSS.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com ------------------------------------------------------------------- OzMOSS.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com
