Wednesday, 29 August 2012

Understanding Publishing Pages

Understanding Published Pages
Site pages that appear in publishing sites have a different structure than those contained in nonpublishing sites. In this section, you will examine what makes publishing pages unique.

Anatomy of a Publishing Page
In a nonpublishing site, pages are essentially normal ASP.NET pages that contain two layers: a master page and a content page. The master page contains the markup that defines the structure and general layout of the page. This usually includes headers, footers, menus, and content placeholder controls. The content page is then created by defining content to be placed in each of the content placeholders in the designated master page.


Publishing pages are based on the same framework as nonpublishing pages, but the content page Layer is split into two sub layers  the page layout and the content. A page layout (a.k.a. a layout page) defines the content that goes into the placeholders defined in the underlying master page. The page layout also defines its own controls that act as placeholders to be filled in by the content page.

At first glance, this may seem to be an unnecessary complication of the page structure. Why should Adding a third layer make any difference? The answer is found in the mechanism used to deliver the Content to the controls in the layout page.

Publishing Content Types

Each page layout is associated with a SharePoint content type. Recall that content types allow us to define the data fields associated with list items in SharePoint. The content types used with page publishing always derive from a base type named Page. These types, creatively called page content types, contain fields that support the publishing and scheduling mechanisms of publishing sites.

The content type for a particular page layout contains fields, in addition to those associated with the Page type, that represent the content that should appear on the site page. As a result, the content changes for a web page are reduced to simple data fields, making them much easier to manage than the HTML and ASP.NET markup that make up a nonpublishing content page.



Standard Publishing Content Types and Layouts

Article page
o   ArticleLeft.aspx
o   ArticleLinks.aspx
o   ArticleRight.aspx
o   PageFromDocLayout.aspx
Enterprise Wiki page
o   EnterpriseWiki.aspx
Project page
o   ProjectPage.aspx
Redirect page
o   RedirectPageLayout.aspx
o   VariationsRootPageLayout.aspx
Welcome page
o   BlankWebPartPage.aspx
o   WelcomeLinks.aspx
o   WelcomeSplash.aspx
o   WelcomeTOC.aspx

Note: Page layouts are not stored in the site but in the Master Page Gallery associated with the site collection. This is important because it changes how page layouts are managed. When a page layout is modified, it affects the entire site collection, not just one site. Therefore, the security and approval requirements for page layouts are more like those for master pages than for ordinary site pages in nonpublishing sites.






NEW THEME FROM POWERPOINT

1.    Open PowerPoint 2010. Create a new blank slide presentation.
2.    Click on Design on the ribbon
3.    From the theme selector list, select a theme for your requirement
4.    Click the theme selector drop-down menu and select Save Current Theme.
5.    Save the theme on your desktop as CustomPowerPointTheme.
6.    Close PowerPoint 2010 without saving the presentation.
7.    Open the root site of the SharePoint site collection in your browser.
8.    From the Site Actions menu, select Site Settings.
9.    Under Galleries section, Click on Themes
10.  Click on Documents, Click on Upload , select the CustomPowerPointTheme, click on ok.
11.  Enter the description and click on ok.
12.  Go to your site, From Site actions menu, Select site settings.
13.  From look and feel, Click on Site Theme.
14.  Find your CustomPowerPointTheme theme and select it. Click the apply button
 Now go to home site you will see the applied theme

Add CSS Registration to a Master Page

1.    Open the site in SPD 2010
2.    Select the master pages from site objects
3.    Create the master page (copy and paste the existing master page) , Name it as style.master
4.    Edit in advanced mode, add the following code at the end of <head> tag.
<SharePoint:CssRegistration name=”<% $SPUrl:~sitecollection/Style Library/MohanDemo/css/mynav.css %>” After=”corev4.css” runat=”server”/>

5.    Open the top-level site in SPD 2010, in Site Objects , select All files, Click on Style Library.
6.    Add New folder (MohanDemo), With in this, Create another folder(css), in this create a new mynav.css file and add the following code.

/*----Top Nav---------------- */
.s4-tn {min-height:34px;}
/*allow nav item to be taller than 15px*/
.s4-tn LI.static > .menu-item{height:auto;}
/*Transform top nav links to uppercase
and give top links bg color */
body #s4-topheader2{
background:#fff repeat-x left 0px;
border-bottom:transparent;border-top:transparent;
}
/*bottom border of nav bar*/
.s4-tn {border-bottom: 5px solid #016c9b;}
.s4-tn > .horizontal {
/*move horizontal nav to the right by 20 px*/
margin-left:20px;
}
/*keep nav from wrapping */
.menu-horizontal{min-width:790px;}
/*If you define nav styles and don’t define them
in dynamic children selectors,
dynamic will inherit the style */
.s4-tn li.static > .menu-item{
border:0;
border:none;
color:#efefef;
display:inline-block;
min-width:70px;
height:36px;
padding:0px;
margin:0px;
vertical-align:middle;
white-space:nowrap;
text-align:center;
font-size:19px;
white-space:nowrap;
padding-top:12px;
}
.s4-toplinks .s4-tn > .menu-item.text {
padding:6px 24px 0 24px;}
/*nav link hover and nav header hover*/
.s4-tn li.static > a:hover,
.s4-tn li.static > .dynamic-children:hover{
display:block;
background:transparent none;
color:#fff;
text-decoration:none;
}
/*rounded nav*/
.s4-toplinks .s4-tn .static > li {
background:url(“../images/tl.png”)
no-repeat scroll 0 0 #79BBEC;
color:#efefef
}
.s4-toplinks .s4-tn .static > li > .menu-item{
background:url(“../images/tr.png”)
no-repeat scroll top right ;
}
/*Rounded nav selected (left) background color goes here*/
.s4-toplinks .s4-tn .static > li.selected {
background:url(“../images/tl.png”)
no-repeat scroll 0 0 #efefef;
color:#5893CF
}
/*Rounded nav selected (right)*/
.s4-toplinks .s4-tn .static > li.selected > .menu-item{
background:url(“../images/tr.png”)
no-repeat scroll top right ;
color:#5893CF
}
.s4-toplinks .s4-tn .static > li.selected > a:hover {
color:#fff;
}
.s4-toplinks .s4-tn ul.static >
li.dynamic-children .menu-item-text ,
.s4-toplinks .s4-tn ul.static >
li.static .menu-item-text{
padding: 0 33px;
}
/*arrows in tabs with dynamic children*/
.menu-horizontal span.dynamic-children
SPAN.additional-background {
background-position:90% ;
}
.menu-horizontal a.dynamic-children
SPAN.additional-background {
background-position:90%;
}
/*flyout navigation */
.s4-tn ul.dynamic{
background:#A2CFEC;
margin:5px 0 0 10px;
background-color:#A2CFEC;
border:1px solid #44A0E5;
}
.s4-tn li.dynamic a{padding:5px;color:#1987DC;}
.s4-toplinks .s4-tn ul.dynamic .menu-item .menu-item-text {
padding: 5px 8px!important;
}
.s4-tn li.dynamic > .menu-item{
padding:3px 12px;
font-size:12px;
white-space:nowrap;
border-bottom:none;
font-weight:normal;
color:#003B55;
font-family:Verdana;
min-width:150px;
}
.s4-tn li.dynamic {border-bottom:1px #88C7F0 solid;}
.s4-tn li.dynamic > a:hover{
font-weight:400;
display:block;
background-color:#C7E2F3;
color:#1E6592;
}

7.    Save, Check in, Publish.
8.   Set as default master page.
 

Friday, 24 August 2012

Master Pages

Master Pages
There are many master pages available in SharePoint Foundation Server. SharePoint provides a variety of master pages
1.    v4.master
2.    default.master
3.    minimal.master
4.    simple.master
5.    MWSDefaultv4.master
6.    nightandday.master

The v4.master  is the default master page for most non-publishing sites in SharePoint 2010. It is also the default system master page in both SharePoint Foundation and SharePoint Server.
The v4.master page is included in every site in both SharePoint Foundation and SharePoint Server 2010. It can be used with publishing sites and non-publishing sites. You learned earlier that master pages contain HTML, CSS, SharePoint controls, and ContentPlaceholder controls.
 
The default.master page in SharePoint 2010 should look familiar to you if you worked with SharePoint 2007.

The minimal.master page is best suited for pages with minimal branding and navigation. The minimal.master is used with search pages and Office web applications. Because this master page does not include the ribbon or navigation, you should use it for pages that require a lot of real estate.
The simple.master is the master page used for error and login pages. It lives in the fi le system and is not available in the master page gallery. If you are creating a custom login or error page, you will want to use the simple.master page.
The MWSDefaultv4.master is found in the master page gallery of meeting workspace sites. It is almost identical to the v4.master with the exception of a couple of content placeholders such as the MeetingNavigator.
The nightandday.master page, is only available in SharePoint Server 2010. It contains controls specialized for publishing web content management.

Importing and Exporting Master Pages

1.    Open the site in SPD 2010
2.    Under site objects Select Master Pages
3.    Select the v4.master so that it is highlighted by clicking once on it.
4.    Click the Export File button on the ribbon, A Save dialog box appears, save the file as v4Test.master in physical location.
5.    Now click on Import file on ribbon, click on Add file, Browse, select v4Test.master, click on Ok.


Applying a New Master Page

6.    Click Master Pages in Site Objects.
7.    Locate the Master Page you want to use (v4Test.master)
8.    Right-click the Master Page and select Set as Default Master Page on the context menu.

Fix the Width of a Master Page

1.    Open a team site in SharePoint Designer.
2.    Select the Master Pages section of Site Objects.
3.    Create a new master page by following the steps you used to create v4Test.master.
4.    Instead of naming the fi le v4Test.master, name it FixedWidthv4.master.
5.    Right-click on the fi le and select “Set as Default Master Page.”
6.    Right click on the fi le and select “Edit File in Advanced Mode.” Add the following embedded style sheet into the master page just before the closing </head> tag

<style type=”text/css”>
/*fixed width */
#s4-workspace > div,#s4-bodyContainer > div,body #s4-titlerow > div{
width:1000px;
margin:0 auto;
float:none;
padding:0;
}

body #s4-mainarea{
/*make main area have background of white and add a border */
background:#fff;
border:1px solid #ddd;
border-top:0px;
min-height:580px;
/*contain content in all browsers but IE7 */
display:table;
}

/*add padding back to title table*/
.s4-title-inner{
padding:0 0 0 5px;
}
/*background color of site*/
#s4-workspace {
background:#efefef /*none*/;
}
/*body container */
#s4-bodyContainer{
position:relative;
width:100%;
}
/*fix overhanging tables*/
.ms-v4propertysheetspacing
{margin:0;}
</style>

7.    Save and check in your changes.
8.    Navigate to your browser and preview your changes in the browser to see your site is fi xed-width

Changing the Location of the Search Box

1.    Open site in SharePoint Designer
2.    Select Master Pages from the Site Objects.
3.    Copy and paste the v4.master, Name it as Search.master.
4.    Right-click the fi le and select Edit File in Advanced Mode.
5.    Locate <td class=”s4-titletext”>.
6.    Add the following code after the closing tag of <td class=”s4-titletext”>:
<td class=”customSearch” valign=”middle” style=”padding:0 5px;”> </td>
7.    To find the search content control (Use the shortcut key Ctrl+F to open the Find and Replace dialog) type the word “search” in the “Find What” field and click the Find All button.
8.    The results of your search are displayed below the page editor in the Find1 window.
9.    Double-click on the ContentPlaceHolder control whose ID attribute is set to PlaceholderSearchArea in the Find1 box and your cursor will jump to the location of the search control in the code window
10.  Select the following code and copy with Ctrl+C.
 <asp:ContentPlaceHolder id=”PlaceHolderSearchArea” runat=”server”>
<SharePoint:DelegateControl runat=”server” ControlId=”SmallSearchInputBox” Version=”4”/> </asp:ContentPlaceHolder>
11.  Paste the copied code inside the <td class=”customSearch”> tag
12.  Save and Check in the file.
     13. Navigate to the site’s URL and preview your changes in the browser.

Registering External CSS

Add CSS Registration to a Master Page

1.    Open the site in SPD 2010
2.    Select the master pages from site objects
3.    Create the master page (copy and paste the existing master page) , Name it as style.master
4.    Edit in advanced mode, add the following code at the end of <head> tag.
<SharePoint:CssRegistration name=”<% $SPUrl:~sitecollection/Style Library/MyDemo/css/mynav.css %>” After=”corev4.css” runat=”server”/>
5.    Save, set as default master page.

6.    Open the top-level site in SPD 2010, in Site Objects , select All files, Click on Style Library.
7.    Add New folder (MyDemo), With in this, Create another folder(css), in this create a new mynav.css file and add the following code.

/*----Top Nav---------------- */
.s4-tn {min-height:34px;}
/*allow nav item to be taller than 15px*/
.s4-tn LI.static > .menu-item{height:auto;}
/*Transform top nav links to uppercase
and give top links bg color */
body #s4-topheader2{
background:#fff repeat-x left 0px;
border-bottom:transparent;border-top:transparent;
}
/*bottom border of nav bar*/
.s4-tn {border-bottom: 5px solid #016c9b;}
.s4-tn > .horizontal {
/*move horizontal nav to the right by 20 px*/
margin-left:20px;
}
/*keep nav from wrapping */
.menu-horizontal{min-width:790px;}
/*If you define nav styles and don’t define them
in dynamic children selectors,
dynamic will inherit the style */
.s4-tn li.static > .menu-item{
border:0;
border:none;
color:#efefef;
display:inline-block;
min-width:70px;
height:36px;
padding:0px;
margin:0px;
vertical-align:middle;
white-space:nowrap;
text-align:center;
font-size:19px;
white-space:nowrap;
padding-top:12px;
}
.s4-toplinks .s4-tn > .menu-item.text {
padding:6px 24px 0 24px;}
/*nav link hover and nav header hover*/
.s4-tn li.static > a:hover,
.s4-tn li.static > .dynamic-children:hover{
display:block;
background:transparent none;
color:#fff;
text-decoration:none;
}
/*rounded nav*/
.s4-toplinks .s4-tn .static > li {
background:url(“../images/tl.png”)
no-repeat scroll 0 0 #79BBEC;
color:#efefef
}
.s4-toplinks .s4-tn .static > li > .menu-item{
background:url(“../images/tr.png”)
no-repeat scroll top right ;
}
/*Rounded nav selected (left) background color goes here*/
.s4-toplinks .s4-tn .static > li.selected {
background:url(“../images/tl.png”)
no-repeat scroll 0 0 #efefef;
color:#5893CF
}
/*Rounded nav selected (right)*/
.s4-toplinks .s4-tn .static > li.selected > .menu-item{
background:url(“../images/tr.png”)
no-repeat scroll top right ;
color:#5893CF
}
.s4-toplinks .s4-tn .static > li.selected > a:hover {
color:#fff;
}
.s4-toplinks .s4-tn ul.static >
li.dynamic-children .menu-item-text ,
.s4-toplinks .s4-tn ul.static >
li.static .menu-item-text{
padding: 0 33px;
}
/*arrows in tabs with dynamic children*/
.menu-horizontal span.dynamic-children
SPAN.additional-background {
background-position:90% ;
}
.menu-horizontal a.dynamic-children
SPAN.additional-background {
background-position:90%;
}
/*flyout navigation */
.s4-tn ul.dynamic{
background:#A2CFEC;
margin:5px 0 0 10px;
background-color:#A2CFEC;
border:1px solid #44A0E5;
}
.s4-tn li.dynamic a{padding:5px;color:#1987DC;}
.s4-toplinks .s4-tn ul.dynamic .menu-item .menu-item-text {
padding: 5px 8px!important;
}
.s4-tn li.dynamic > .menu-item{
padding:3px 12px;
font-size:12px;
white-space:nowrap;
border-bottom:none;
font-weight:normal;
color:#003B55;
font-family:Verdana;
min-width:150px;
}
.s4-tn li.dynamic {border-bottom:1px #88C7F0 solid;}
.s4-tn li.dynamic > a:hover{
font-weight:400;
display:block;
background-color:#C7E2F3;
color:#1E6592;
}

8.    Save, Check in, Publish.
9.    Now refresh the browser.