Microsoft Office SharePoint DesignerMaster PagesHOL384.docx
《Microsoft Office SharePoint DesignerMaster PagesHOL384.docx》由会员分享,可在线阅读,更多相关《Microsoft Office SharePoint DesignerMaster PagesHOL384.docx(28页珍藏版)》请在冰豆网上搜索。
![Microsoft Office SharePoint DesignerMaster PagesHOL384.docx](https://file1.bdocx.com/fileroot1/2022-12/7/a7d7efa6-11bd-4c7a-b0a8-63ca0478f837/a7d7efa6-11bd-4c7a-b0a8-63ca0478f8371.gif)
MicrosoftOfficeSharePointDesignerMasterPagesHOL384
Hands-onLabOverview
1.Introduction
HOL384:
MicrosoftOfficeSharePointDesigner2007–MasterPages
2.TechnologiesHighlighted
∙Microsoft®Windows®SharePoint®Services3.0
∙Microsoft®OfficeSharePoint®Designer2007
∙MasterPages
3.Audience
ITPro–300level
4.Scenario
ThislabwillcoverseveraltypesofMasterPagecustomizationavailableinMicrosoftOfficeSharePointDesigner2007startingwithaddingglobalsitelinksandcopyrightinformationtoamasterpageandmovingtodesigningaMasterPagefromthegroundup.
5.PurposeofHands-onLab
ThislabwillexplainthedifferenttypesofMasterPagesthatMicrosoftOfficeSharePointDesigner2007isabletoutilize,aswellashowtodesignanewMasterPageforSharePoint.
Hands-onLab
DiscussionPoints
Actionstaken
UsingMicrosoftOfficeSharePointDesigner2007toCustomizeSharePointMasterPages
Thissectionwillcoverbasiccustomizationsofmasterpages.
Setup
∙Login,usingthefollowingcredentials:
∙Logon:
administrator
∙Password:
pass@word1
∙WaitfortheWarmupscripttocompleteandclose
AddGlobalLinkstoMasterPage
Inthissection,corporatelinkswillbeaddedtothetopnavigationbarofaSharePointsitebyeditingaMasterPage.
OfficeSharePointDesigner2007usersmaynoticethatwhentheyclickandtrytomodifycertainpartsofaWebPartpagetheyareunabletoso.ThisisbecausethatcontentisnotactuallypartoftheWebPartitisdefinedbythemasterpageitreferences.Thebasicconceptbehindmasterpagesistocreatethelayoutforanapplicationinonefile.Thelayoutdefinesspecificareas(ContentPlaceHoldercontrols)thatpagesthatusethemasterpagecanaddcontentto.TheindividualcontentpagesthenreferencethemasterpageandaddcontenttoContentcontrolswhichreferencethemasterpage’sContentPlaceHoldercontrols.Thisreducesdevelopmenttimeanderrorsbyeliminatingtheneedtoreproducethelayoutcodeoneachpage.AsitehasoneDefaultMasterPagesetting.EachSharePointsitedefinitionincludesadefault.masterfilewhichissetastheDefaultMasterPagesetting.TheindividualWebPartpagessuchasdefault.aspxandAllItems.aspxineachlistreferencethismasterpage.
InMOSSthereisanotherimportantmasterpagesetting,CustomMasterPage.TheCustomMasterPageisusedinpublishingpageslocatedinasite’sPagesdirectory.
∙InSharePointDesigner,openthesiteifitisnotalready
∙IntheFolderListtaskpane,expandthe_catalogdirectorythenexpandmasterpage(MasterPageGallery)subdirectory,doubleclickondefault.master
∙ClickYesbuttonintheCheckoutdialogifitpopsup
∙OpenaFindandReplacedialogbyhittingCRTL+F
∙IntheFindandReplacedialog,typeGlobalSiteLink2intheFindwhattextboxandclickFindNext
∙Movethecursorinfrontoftheparentclosingtrtag()oftheGlobalSiteLink2DelegateControl.TheHTMLshouldlikesimilartothis(withthetargettrtaghighlighted):
DelegateControlControlId="GlobalSiteLink1"Scope="Farm"runat="server"/>
DelegateControlControlId="GlobalSiteLink2"Scope="Farm"runat="server"/>
∙GototheendofthelineandhitEnterbutton
∙Typeorcopy/pastethefollowingtoaddaHelpDesklink:
3px'>
//helpdesk">HelpDesk
4px;padding-right:
3px'>|
∙Theresultoftheeditshouldlooksimilartothefollowing:
DelegateControlControlId="GlobalSiteLink1"Scope="Farm"runat="server"/>
DelegateControlControlId="GlobalSiteLink2"Scope="Farm"runat="server"/>
3px'>
//helpdesk">HelpDesk
4px;padding-right:
3px'>|
|
∙[Optional]AddthefollowingHTMLbeforetheclosingtrtagtoaddCorporateDirectoryandTermsofUselinks
3px'>
//terms">TermsofUse
4px;padding-right:
3px'>|
3px'>
//directory">CorporateDirectory
4px;padding-right:
3px'>|
∙SavethefilebyhittingCtrl+S
∙IntheFolderListtaskpane,rightclickonAdvWorks.aspxandselectPreviewinBrowser
∙NoticethenewHelpDesklink(TermsofUseandCorporateDirectoryifstep10wascompleted)atthetopofthepage
∙Closethebrowser
AddCopyrightNoticetoMasterPage
Thissectionshowshowtoaddacopyrightnoticetothebottomofallofasite’spagesbymodifyingthesite’sdefaultmasterpage.
Thetext©inHTMLproducescopyrightsymbol(©).
TheaspnetisabasicSharePointTeamSite.IfSharePointPublishingfeatureswereenabled,thesite’scustommasterpagewouldalsohavetobeeditedorthenewdefault.masterpagewouldhavetobesetthecustommasterpageofthesite.
InsiteswiththeSharePointPublishingfeatureenabled(availableonMOSSservers)theDefaultandCustomMasterPagesettingscanalsobesetintheSiteMasterPageSettingspage(accessiblefromtheSiteSettingspage).Thepage’sSiteMasterPagesettingcorrespondstothesite’sCustomMasterandtheSystemMasterPagecorrespondstoDefaultMaster.Themasterpagedropdownlistsarepopulatedfromthemasterpagecataloginrootsiteofthesitecollection.
Note:
Theerrormessage“Thesitemasterpagesettingcurrentlyappliedtothissiteisinvalid.Pleaseselectanewmasterpageandapplyit”frequentlyshowsuponthispage.Itisapotentialbugandjustignoreit.
Pagesinthe_layoutsdirectorydonotreferenceDefaultorCustomMaster.Theyusespecialmasterpagesinthe_layoutsdirectory.Modifyingmasterpagesinthe_layoutsdirectoryisnotsupported.
∙IntheFolderListtaskpane
∙Rightclickondefault.masterandselectCopy
∙Rightclickonmasterpage(MasterPageGallery)andselectPaste
∙RightclickonCopyofdefault.masterandselectRename
∙Typecopyright.masterandhitEnter
∙OpentheFindandReplacedialog,byhittingCRTL+F
∙IntheFindandReplacedialog,enterPlaceHolderMainintheFindwhattextboxandclickFindNext
∙Movethecursortoafterthenextclosingtrtag()andhitEnter
∙Typeorcopy/pastethefollowingtext:
|
bottom;text-align:
center">
Allrightsreserved.
|
∙Afterthechangesthesectionshouldlooksimilartothefollowing:
ContentPlaceHolderid="PlaceHolderMain"runat="server">
ContentPlaceHolder>
|
bottom;text-align:
center">
Allrightsreserved.
|
∙SavethefilebyhittingCrtl+S
∙IntheFolderListtaskpane,rightclickcopyright.masterandselectSetasDefaultMasterPage
∙IntheFolderListtaskpane,doubleclickAdvWorks.aspx
∙SavethefilebyhittingCrtl+S
∙IntheFolderListtaskpane,rightclickAdvWorks.aspxandselectPreviewinBrowser
∙Noticethecopyrightnoticeatthebottomofthepage
∙Closethebrowser
CreateaMasterPagefromaBlankMaster
Inthissectionanewmasterwillbecreatedfromablankmasterpage.
Asdiscussedearlier,SharePointmasterpagesdefineContentPlaceHoldercontrolsthatsetwherepagesinheritingthemasterpagecanaddcontent.ThemasterpagesthatyoudesignmustdeclarethesameContentPlaceHoldercontrols.Ifyourmasterpagelacksthesecontrols,youmayencountererrorswhenchildpagesattempttoaddcontenttothem.FormoreinformationabouttheContentPlaceHoldercontrolsthatmustbedeclaredinallSharePointmasterpagesvisit
Anytimethepromptwarningthatwithoutmatchingcontentregionsthechildpageswillbreakappearsdoublecheckthemasterpagebeforesettingitasthedefault.
Inthissectioncodewillbecopiedfromdefault.mastertothenewlitware.mastertospeedtheprocessandtoavoidmistakes.CopyingneededcontentfromanexistingworkingSharePointmasterpageisthemostreliableandleasterrorpronemethodforcreatinganewmasterpage.
Importantchildelements/controlsoftheheadtag.
ContentPlaceHolderid=PlaceHolderPageTitlerunat="server"/>
∙Thetitleelementofthepagewhichdisplaysinthetitlebarofthebrowser.ThePlaceHolderPageContentPlaceHoldercontrolisreferencedbyaContentcontrolintheinheritingpagewherethetitleisset.
CssLinkrunat="server"/>
∙Addthereferencetothecore.cssfilethathasthebasecssclassesusedinallpagesinSharePoint.Othercssfilescaneasilybeincludedwhiledefiningpages,butitisimportantthatthiscontrolremainsonthepageaschildcontrolssuchasWebPartswillstillcontinuetousecssclassesdefinedinthisfile.
Themerunat="server"/>
∙Addareferencetothecurrenttheme’scssfiletothepage.
ScriptLinklanguage="javascript"name="core.js"Defer="true"runat="server"/>
∙Addsreferencecore.jstothepage.Core.jscontainsSharePoint’sbasicjavascriptfunctions.
CustomJSUrlrunat="server"/>
∙Addsth