The best way to create custom templates for your Search & Preview Web controls is to do the following:
1. Go to a page that already contains the Search & Preview Web control type for which you wish to design a new template (e.g., in the Search & Preview Search Center). Go into edit mode and go to the Search & Preview settings page for the relevant Web part.
2. Work with XSLT Template settings by selecting existing templates from the gallery selector and looking at the preview. Identify the existing, default template that most resembles your intended custom template.
3. Click on the Search & Preview style gallery link to open the style gallery. Then navigate to the folder named for the type of Web part you are using.
4. From the gallery, open the appropriate source template in the SharePoint Designer application and save it with a new name at the appropriate path in the Search & Preview Style Gallery. Although Search & Preview uses templates based purely on the XSLT standard, we recommend that you use the SharePoint
Designer both because it offers a helpful interface and because it interacts automatically with the SharePoint database as it should.
5. Use SharePoint Designer to customize the template as needed and save your changes.
6. Return to the Web part for which you designed the template, apply the template and inspect the results.
Use the following techniques to design your template:
• Study the default template when you first open it in SharePoint Designer. You will probably keep many of these settings and only slightly modify many of the others.
• Use standard XSLT programming techniques throughout. See also an XML reference book for advice and ideas.
• To see the pure XML as it is emitted by a given control, set that control’s XSLT Template to “XML”. This is a “neutral” template that passes the XML directly to the output without changing it. The Web part will then display the XML on which your XSLT must operate.
• The XML generated by a given Web part often combines data generated by part with data from the search database and settings made for the specific Web part instance. You should, therefore, make configuration settings representative of those you intend to use the template when generating sample XML input.
|IMPORTANT: Do not modify and overwrite any of the standard templates delivered with Search & Preview. If you do this, then you risk having your customizations deleted later when you update, upgrade or re-install Search & Preview; these operations will often overwrite some or all of the standard templates. Instead, you should always save your custom or customized template with a new name in the Search & Preview Style Gallery.
Need more help with this?
CONTACT US email@example.com OR use our homepage