Type of Master Pages
There are 3 main types of Master Pages in SharePoint:
1.Site Master Pages
2.System Master Pages
3.Application Master Pages
This technique is not specific to publishing pages. A good example of this is the meeting workspace site in MOSS. This site definition is not a publishing site. However the main page is different than the subpages. This is accomplished by making the main page a site master page.
Site master pages are defined by ~masterurl/custom.master in the content page declaration.
System master pages are used for most non-publishing sites and subpages in publishing sites. The system master page is what you typically see when you go to a WSS site or a non-publishing MOSS site.System master pages are defined by ~masterurl/default.master in the content page declaration.
Application master pages are for all “Layout” pages. Layout pages are SharePoint administrative pages that are typically seen when doing site administration. You can tell a layout page because the URL of the site has _layout in it. Layout pages are static, file server pages that are not driven by the database like other pages in SharePoint. We will discuss application pages in more detail in article 5 of this series because of the difficulties involved in understanding and customizing them.
Application master pages can be found at: %Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS.
Create a Feature: Add Custom Master Pages to your Site Collections
- Navigate to the Features directory on your web server: Local Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES
- Locate the PublishingLayouts Feature directory. Copy this folder and paste it at the root of Features. Rename the folder to a unique name of your choice. For my example I used CustomMasterPages.
3. Open your new Feature directory. At this point you can leave all the default folders, or you can choose to clear out what you don't want to use. You only have to keep Feature.xml and ProvisionedFiles.xml. To create a clean file set, at a minimum clear out the contents of each sub folder in the directory (en-us (or your language), Images, MasterPages, PageLayouts, Styles).
4. To start, we need at least one master page file in the Feature folder. You can copy one of the existing master pages, paste the copy in the directory, and rename the copy to your unique name, or alternately paste in your custom master page, or create a new blank file with the extension of .master.
5. Next, open the ProvisionedFiles.xml file in Notepad or a similar editing application. Local Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\YourFeature
6. We are going to delete out all of the content and only keep the OSGMasterPages Module tag and the PublishingLayoutsPreviewImages Module tag. As opposed to listing out what to strip out, here is the code you need in this file:
7. Update the properties to reflect the new master page details:
a. Change the URL to your custom master page.:
b. Change the Preview Images to a custom image:
c. Update the Description. Enter a description for your master page:
d. Update the image names:
8. Save the ProvisionedFiles.xml file.
9. Create a preview image in the language folder (in this case, en-us).
10. Next, open the Feature.xml file in Notepad or a similar editing application. Local Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\YourFeature
11. There are four things you need to edit in this file:
e. Change the Feature ID to a unique GUID. You can generate GUIDs in Visual Studio (Tools - Create GUID - Registry Format - Copy). Paste the new GUID for the ID and remove the curly brackets.
g. Update the description:Description="Custom master pages for use across multiple site collections."
h. Change the Hidden state to False:Hidden="False"
12. Save the Feature.xml file.
13.Recycle the Application Pool for the site you plan to install the Feature on, or reset IIS (Command Prompt - IISRESET).
14. You are now ready to install the new Feature on the web server. Open a Command Prompt and enter the following:
i. Change directories to the BIN folder in the 12 hive so you can use STSADM.exe:cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
j. Launch STSADM and install the feature:stsadm -o installfeature -name YourFeatureDirectoryName
15. Now we will activate the feature on the site.
k. Open your site and navigate to the Site Collection Features settings page. Site Actions - Site Settings - Modify All Site Settings - Site Collection Features (under the Site Collection Administration submenu).
l. The new feature will be listed:
m. Select Activate.
16. The master pages are now ready to use on the site. Navigate to the Master Page settings by selecting Site Settings in the breadcrumbs and choosing Master Page. (Or Site Actions - Site Settings - Modify All Site Settings - Master page (under the Look and Feel submenu).
17. Depending on your requirements, in either or both the Site Master Page setting and the System Master Page setting, select your drop down box and choose your custom master page.
18. Select OK.
Adding to our Feature: Adding More Custom Master Pages to your Feature
If you ever need to add new master pages to this feature, you can edit the Feature and redeploy it. Alternately, you can create a new Feature for each custom master page. For that scenario, just follow the steps above for creating a new feature. The following outlines how to update your Feature with new master pages.
- Navigate to your custom master page Feature directory and add the appropriate files for your new master pages.
- Navigate to and open the ProvisionedFiles.xml file. Add a FILE tag block for each new master page for both the OSGMasterPages Module and the PublishingLayoutPreviewImages Module. Save the file.
- Recycle the Application Pool for the site you plan to install the Feature on, or reset IIS (Command Prompt - IISRESET).
- You are now ready to reinstall the updated Feature on the web server. Open a Command Prompt and enter the following:
a. Change directories to the BIN folder in the 12 hive so you can use STSADM.exe:cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
b. Launch STSADM and install the feature:
stsadm -o installfeature -name YourFeatureDirectoryName -force
5. Now we will deactivate and reactivate the feature on the site.
a. Open your site and navigate to the Site Collection Features settings page. Site Actions - Site Settings - Modify All Site Settings - Site Collection Features (under the Site Collection Administration submenu).
b. Your existing feature will be listed:
c. Select Deactivate.
d. A warning message will appear. Select Deactivate the feature.
e. The Feature list will reload. Select Activate next to your custom feature.
6. Your new master pages are ready for use.
Custom Site Theme for SharePoint 2007
1. On the SharePoint Server go to the Themes folder e.g. C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\THEMES
2. Copy one of the theme folders from there and paste it in the same directory and give the folder a unique name, say MyTheme.
3. Find the .inf file in the copied folder, and rename it with the name given to the folder i.e. in this example rename that .inf file with MyTheme.INF
4. Open the .inf file and assign the same name i.e. MyTheme to the title in the [info] section of the file, and in the [titles] section replace the previous names with your new name.
5. There is one theme.css file in that MyTheme folder, open that, delete all the classes from that file and place your own css classes in that file.
6. Open “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\SPTHEMES.XML” file with notepad
7. Add the following lines under tag
8. Where Template ID must be that of same name as that of the folder.
9. In order to display thumbnail and preview correctly, you will need to capture the screen and save the file in "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\IMAGES" folder with MyTheme.gif name. You can change the .gif file name if you change the thumbnail and preview file names in tag.
10. Do an iisrest for the server to recognize the new theme.
11. Open your SharePoint site and go to the theme page by typing following URL in address bar: _layouts/themeweb.aspx
12. Select the theme and apply it to your site by clicking the Apply button.
To change your SharePoint theme, please follow these steps:
1. Open a web browser and log into SharePoint
2. Click Site Actions and select Site Settings
3. Under Look and Feel, click Site theme.
4.Choose a theme from the list.
5.Click Apply.
Common error when we applying the theme
A theme with the name "THEMENAME 1011" and version already exists on the server.
1.(THEMENAME is the name of theme you have created).
WHY?? I had followed standard steps and yet I get the error? hum.... something cheesy here. Guess what? the theme name I had selected for my there was longer than 8 characters!!!! That is it!!! I made it 7 characters and it worked fine! So if you have such error, that might be the reason (also AFAIK, you have to make sure CodePage is unique)
OR
2.Go into SharePoint Designer and open the subsite. Under the _theme folder, delete the folder for the theme you just created.
That should resolve the error.
No comments:
Post a Comment