Showing posts with label Master Page. Show all posts
Showing posts with label Master Page. Show all posts

Wednesday, October 10, 2012

MasterPageFile Reference

On top of the page there is a line where the master page can be defined manually, or to be the default and custom master page:
<%@ Page language="C#" MasterPageFile=  ../_catalogs/masterpage/<Master Page File Name>.master meta:progid="SharePoint.WebPartPage.Document" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" meta:webpartpageexpansion="full" %>

MasterPageFile Value
Definition
MasterPageFile="~masterurl/custom.master"

Dynamic custom master page defined in the “Site Settings -> Look and Feel -> Master Page” section.
MasterPageFile="~masterurl/default.master"

Defines the master page according to the page layout. On OOTB page layout, the master page will be v4.master for example.
MasterPageFile="../_catalogs/masterpage/Master.master"

Static specific master page definition.

Navigation Controls Values

There are some controls to navigate through in the master page, for example, logo control, site name control and more.
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/" id="onetidProjectPropertyTitleGraphic">

        <SharePoint:SiteLogoImage name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl="/_layouts/images/siteIcon.png" runat="server"/>
    </SharePoint:SPLinkButton>

NavigateUrl Value
Result
~sitecollection/ or /
Leads to the root welcome page (site collection)
~site/
Leads to the current site welcome page.

Hope it helps,
Me.

Monday, February 13, 2012

Relative Links

If you have stored your CSS and JavaScript within the physical file directory situated in the 14 hive folder, or in a static place as in the Style Library in the root, you will need to modify the above example to the following:
<!-- CSS -->
<SharePoint:CSSRegistration Name="<% $SPUrl:~SiteCollection/Style Library/CSS/Style.css%>" runat="server"/>

<!-- JavaScript -->
<SharePoint:ScriptLink ID="ScriptLink1" Name="<% $SPUrl:~SiteCollection/Style Library/Script/Script.js%>" runat="server"/>
This code is useful using content deployment for example.

Hide the Ribbon in Anonymous Mode

Go to your master page and find the "s4-ribbonrow" div:
<div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle">
Add inline style "display:none" to it:
<div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle" style="display:none">
Insert the following code AFTER the s4-ribbonrow div closes:
<Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="AddAndCustomizePages">
    <script type="text/javascript">
        document.getElementById("s4-ribbonrow").style.display = "block";
   
</script>
</
Sharepoint:SPSecurityTrimmedControl>
Read more at:

Customizing SharePoint 2010 Social Tags: I Like It | Tags & Notes

The social tags in the Master Page can be changed from:
<SharePoint:DelegateControl ControlId=”GlobalSiteLink3″ Scope=”Farm” runat=”server”/>
To the “mini” mode:

<SharePoint:DelegateControl ControlId=”GlobalSiteLink3-mini” Scope=”Farm” runat=”server”/>
Read more at:

Sunday, February 12, 2012

Centered layout with CSS & v4.master

When customizing SharePoint 2010 Master Page with a static width, you often want to center the content of the page.
Here is the CSS for centering the contents in the ribbon container and letting the container it behave as designed:
#s4-ribbonrow > #s4-ribboncont > #RibbonContainer > #Ribbon > .ms-cui-ribbonTopBars > div {
width: 990px;
margin: 0 auto;
float: none;
}

#s4-ribbonrow > #s4-ribboncont > #RibbonContainer > #Ribbon > .ms-cui-ribbonTopBars > div,
#s4-bodyContainer > div,
body #s4-titlerow > div
{
width: 990px;
margin: 0 auto;
float: none;
}

read more at: