|
The content page definition shown in the code could not be any simpler. It does
nothing other than add a minimal fragment of HTML content inside
PlaceHolderMain. However, it produces the standard Windows SharePoint Services
page layout with site icons, menus, and navigation bars, as shown in Figure
1-3. Once you learn how to use the standard set of placeholders defined in
default.master, you can easily swap out standard Windows SharePoint Services
elements like menus and navigation bars and replace them with your own ASP.NET
controls and Web Parts. This can be done for pages at the scope of a site, a
site collection, or even on a farmwide basis.
Master pages and content pages are stored and loaded using the same concepts of
page templates and page customization discussed earlier. There are page
templates defined for the master page as well as for content pages that reside
on the local file system of the front-end Web server. Each site initially uses
an uncustomized (that is, ghosted) version of the master page template and
content page templates. However, once a user customizes and saves one of these
pages for a particular site using a tool such as Office SharePoint Designer
2007, a customized (unghosted) version is saved in the SQL Server database.
It’s possible to customize the master page for a site while leaving the content
pages uncustomized. Likewise, it’s possible to customize one or more content
pages while leaving the master page uncustomized. Furthermore, if you customize
either the master page or a content page and later wish to undo your changes,
both the browser-based UI of Windows SharePoint Services 3.0 and Office
SharePoint Designer 2007 provide simple menu commands to discard customization
changes from the SQL database and revert back to the original page template.
![Figure 1-3 It’s easy to create custom content pages that use the standard Windows SharePoint Figure 1-3 It’s easy to create custom content pages that use the standard Windows SharePoint]()
Figure 1-3 It’s easy to create custom content pages that use the standard
Windows SharePoint Services layout.
You might have noticed in the code on previously that the content page shown in
Figure 1-3 links to the master page using a special syntax in the form of
~masterurl/default.master. This is a tokenized reference to a master page that
can be changed programmatically on a site-wide basis. You can accomplish this
by acquiring an SPWeb reference to the current site and then updating the
MasterUrl property.
Note that each site has its own Master Page Gallery with a default.master and
its own Master- Url property. That means all the sites in a site collection do
not automatically use the same master. However, with the use of recursion it’s
pretty easy to write some code against the Windows SharePoint Services 3.0
object model to synchronize a top-level site and all the child sites in a site
collection to use the same master pages.
|