SharePoint development tour (2): sitedefinition custom mother edition page

Source: Internet
Author: User

The method used in this article is probably not the best when you first study Sharepoint. If you have a better solution, please explain it in the reply. Thank you.

  1. Create a new sitedefinition (farm) and modify the template ID in the webtemp file (any number greater than 10000 and cannot be the same as the existing sitedefinition)
  2. In Solution Explorer (CTRL + W, S), expand the sitedenfinition node, right-click the sitedefinition node, and choose add-> Add new item on the right of the dialog box and select Visual C #-> Web, in the right-side HTML page dialog box, change the name to mymaster. master (this name can be customized ).
  3. Change the content of the newly added mymaster. Master:
     <%  @  Master  Language  = "C #"  %> <%  @  Register  Tagprefix  = "SharePoint" Namespace  = "Microsoft. Sharepoint. webcontrols"  Assembly  = "Microsoft. Sharepoint, version = 14.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c"  %> <%  @  Register  Tagprefix  = "Utilities"  Namespace  = "Microsoft. Sharepoint. Utilities"  Assembly  = "Microsoft. Sharepoint, version = 14.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c" %> <%  @  Import  Namespace  = "Microsoft. SharePoint"  %> <%  @  Assembly  Name  = "Microsoft. Web. commandui, version = 14.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c"  %> <%  @  Import  Namespace  = "Microsoft. Sharepoint. applicationpages" %> <%  @  Register  Tagprefix  = "Webpartpages"  Namespace  = "Microsoft. Sharepoint. webpartpages"  Assembly  = "Microsoft. Sharepoint, version = 14.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c"  %> <%  @  Register  Tagprefix  = "Wssuc"  Tagname = "Welcome"  SRC  = "~ /_ Controltemplates/welcome. ascx"  %> <%  @  Register  Tagprefix  = "Wssuc"  Tagname  = "Muiselector"  SRC  = "~ /_ Controltemplates/muiselector. ascx"  %>  <!  Doctype  HTML public "-// W3C // dtd xhtml 1.0 strict // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <  Html  ID  = "Html1"  Lang  ="  <%  $ Resources: WSS, language_value %>  "  Xmlns  :  O  = "Urn: Schemas-Microsoft-com: Office: office"  Runat  = "Server" Dir  ="  <%  $ Resources: WSS, multipages_direction_dir_value %>  "> <  Head  ID  = "Head1"  Runat  = "Server"> <  Meta  HTTP-equiv  = "X-UA-compatible"  Content  = "Ie = 8"/> < Meta  Name  = "Generator"  Content  = "Microsoft SharePoint"/> <  Meta  Name  = "Progid"  Content  = "Sharepoint. webpartpage. Document"/> <  Meta  HTTP-equiv  = "Content-Type"  Content  = "Text/html; charset = UTF-8"/> <  Meta HTTP-equiv  = "Expires"  Content  = "0"/> <  Title  > Master> <  ASP  :  Contentplaceholder  ID  = "Placeholderpagetitle"  Runat  = "Server"> </  ASP  :  Contentplaceholder > </  Title  > </  Head  > <  Body  > <  Webpartpages  :  Webpartmanager  ID  = "Wpmanager"  Runat  = "Server"/> This is a master page! <  ASP  : Contentplaceholder  ID  = "Placeholdermain"  Runat  = "Server"> </  ASP  :  Contentplaceholder  > </  Body  > </  Html  > 

    This is a simple master page, which is basically nothing.

  4.  
    Change the ONet. xml file.

    Open the ONet. xml file and you will find that the project-> modules-> module [name = defaultblank] node contains the master file mymaster. Master We just added.
    Add a module [name = masterpage] under project> modules and set its URL to _ catalogs/masterpage.
    Move the file [url = default. aspx] node under the module [name = defablblank] node to the module [name = masterpage] node.
    Add the module [name = masterpage] node We just created in project-> Configuration-> modules.
    The modified ONet. xml file is roughly as follows:

     <?  XML  Version  = " 1.0 " Encoding  = " UTF-8 " ?> < Project  Title  = " Zhuisha. sitedefinition " Revision  = " 2 " Listdir  = "" Xmlns: ows  = " Microsoft SharePoint " Xmlns  = " Http://schemas.microsoft.com/sharepoint/ "> <  Navbars  > </  Navbars  > <  Deployments  > <  Configuration  ID  = " 0 " Name  = " Zhuisha. sitedefinition " Custommasterurl  = "_ Catalogs/masterpage/mymaster. Master " > <  Lists  /> <  Sitefeatures  > </  Sitefeatures  > <  Webfeatures  > </  Webfeatures  > <  Modules  > <  Module  Name = " Masterpage " /> <  Module  Name  = " Defaultblank " /> </  Modules  > </  Configuration  > </  Deployments  > <  Modules  > < Module  Name  = " Masterpage " URL  = " _ Catalogs/masterpage " > <  File  Path  = " Mymaster. Master " URL  = " Mymaster. Master "/> </  Module  > <  Module  Name  = " Defaultblank " URL  = "" Path  = "" > <  File  URL  = " Default. aspx "Path  = " Default. aspx " > </  File  > </  Module  > </  Modules  > </  Project  > 

  5. Modify sitedefinition-> default. aspx:
     <%  @  Page Language  = "C #"  Masterpagefile  = "~ Masterurl/custom. Master"  Inherits  = "Microsoft. Sharepoint. webpartpages. webpartpage, Microsoft. Sharepoint, version = 14.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c"  %> <%  @  Register  Tagprefix  = "SharePoint"  Namespace  = "Microsoft. Sharepoint. webcontrols"  Assembly = "Microsoft. Sharepoint, version = 14.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c"  %> <%  @  Register  Tagprefix  = "Utilities"  Namespace  = "Microsoft. Sharepoint. Utilities"  Assembly  = "Microsoft. Sharepoint, version = 14.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c"  %> <%  @  Register  Tagprefix = "Asp"  Namespace  = "System. Web. UI"  Assembly  = "System. Web. Extensions, version = 3.5.0.0, culture = neutral, publickeytoken = 31bf3856ad364e35"  %> <%  @  Register  Tagprefix  = "Webpartpages"  Namespace  = "Microsoft. Sharepoint. webpartpages"  Assembly  = "Microsoft. Sharepoint, version = 14.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c" %> <%  @  Import  Namespace  = "Microsoft. SharePoint"  %> <%  @  Import  Namespace  = "Microsoft. Sharepoint. applicationpages"  %> <%  @  Assembly  Name  = "Microsoft. Web. commandui, version = 14.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c" %>  <  ASP  :  Content  ID  = "Content1"  Contentplaceholderid  = "Placeholdermain"  Runat  = "Server"> <  H1  > Welcome to the custom site mysitedefinition </  H1  > < Webpartpages  :  Webpartzone  ID  = "Zoon1"  Runat  = "Server"  Title  = "Zoon1"> <  Zonetemplate  > </  Zonetemplate  > </  Webpartpages  :  Webpartzone  > </ ASP  :  Content  > 

  6. Publish (right-click the project node and select deploy)
  7. Create a site collection and select zhuisha. sitedefinition as the template. After the creation is complete, open the new website to see the effect.
  8. Again, I want to learn more about Sharepoint. PS: Do you have to guess about all the things in SharePoint? It's too boring...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.