Export (0) Print
Expand All

How to: Customize Mobile Home Pages

Windows SharePoint Services 3

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This topic provides an overview of the basic procedure for customizing a Windows SharePoint Services 3.0 home page that is accessible to mobile devices. For a detailed procedure, see Walkthrough: Customizing a Mobile Home Page. For an overview of how to customize list view and form pages, see How to: Customize Mobile List View and Form Pages.

As described in detail in Mobile Page Rendering System, controls in the Header (Title), Contents, and Footer (Navigation) areas of a mobile home page each start a chain of calls that results in a call to, respectively, the following three template selector controls.

An object of one of these classes selects a RenderingTemplate object based on the site type of the page being requested, such as an STS, BLOG, or a custom site. This means that you can customize the mobile home page for a specific type of site. For example, you can display a greeting message exclusively on the mobile home pages for STS sites.

NoteNote

Access from mobile devices is not supported for MPS, CENTRALADMIN, and WIKI sites.

These controls look for a RenderingTemplate ID that has the following format:

Mobile_SiteTypeID_HomePage_PageArea

where SiteTypeID can be STS or BLOG or the ID number of a custom site definition and PageAreaspecifiesTitle, Contents, or Navigation as the page area that should be rendered. For more information about the sections of a mobile page, see Layout and Pagination of Mobile Pages.

Depending on the current site type, a SPMobileWebTitle control determines which RenderingTemplate object renders the header section of the mobile home page. For example, the SPMobileWebTitle object will attempt to use a rendering template with the ID Mobile_STS_HomePage_Title to render the header area of an STS home page on a mobile device. If it does not find a rendering template with that ID, it will use one with the ID Mobile_Default_HomePage_Title.

Windows SharePoint Services 3.0 does not ship with a RenderingTemplate element with the ID Mobile_STS_HomePage_Title, You can create one. For information about how, to create a custom rendering template for a mobile page, see Walkthrough: Customizing a Mobile Home Page.

This rendering system means that creation a mobile home page with a custom Header (Title), Content, or Footer (Navigation area) requires only that you create a rendering template with the ID that the page area's template selector control is looking for. (See the procedure below for additional details.)

Existing RenderingTemplates

Listed below are the two RenderingTemplates for mobile home pages that already exist in MobileDefaultTemplates.ascx when Windows SharePoint Services is installed.

  • Mobile_BLOG_HomePage_Navigation

  • Mobile_STS_HomePage_Contents

You may not modify the MobileDefaultTemplates.ascx file. You can create a new RenderingTemplate element (in your own .ascx file) with the same ID as one of these existing rendering templates, but if you do there is a risk that you will break other solutions deployed in Windows SharePoint Services that depend on the original RenderingTemplate object.

NoteNote

The rendering templates that ship with Windows SharePoint Services 3.0 load before custom templates load, so when a custom template with the same ID as one of the existing rendering templates loads, it overrides the original template. If two or more custom rendering templates have the same ID, the one whose file name is alphabetically last will override all the others. If a specific file has two or more rendering templates with the same ID, none of them is loaded.

The following RenderingTemplate objects are also defined in the MobileDefaultTemplates.ascx file. These are used by the runtime whenever a RenderingTemplate object for the current site type is not defined. The same risk is present if you create new RenderingTemplate object with any of these IDs.

  • Mobile_Default_HomePage_Contents

  • Mobile_Default_HomePage_Navigation

  • Mobile_Default_HomePage_Title

You can nest RenderingTemplate objects. See the example below.

To customize a section of a mobile home page

  1. In Microsoft Visual Studio, Notepad, or a text editing application, create a user control file (.ascx) in the the path \Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES.

  2. To register or import the appropriate namespaces, add the necessary page directives to the .ascx file.

  3. Add a rendering template to the .ascx file and give it an ID in the following format: Mobile_SiteTypeID_HomePage_PageArea.

    • SiteTypeID can be STS, BLOG, or the ID number (not the name) of any custom site definition. (The ID of a site definition is set with the ID attribute of a Template element in a WebTemp.xml file. For more about the ID attribute of a site definition, see WebTemp.xml.)

    • PageArea can be Title, Contents, or Navigation.

  4. Save the .ascx file and reset Internet Information Services (IIS) to effect your changes.

The following example of a RenderingTemplate definition shows how you can nest RenderingTemplates. For another example of customizing a mobile home page, see Walkthrough: Customizing a Mobile Home Page.

<SharePoint:RenderingTemplate ID="Mobile_STS_HomePage_Navigation" RunAt="Server">
  <Template>
    <mobile:Link Text="Microsoft" NavigateUrl="http://www.microsoft.com/" RunAt="Server" />
    <SPMobile:SPMobileComponent TemplateName="Mobile_Default_HomePage_Navigation" RunAt="Server" />
  </Template>
</SharePoint:RenderingTemplate>
Show:
© 2014 Microsoft