Search Results Look-and-feel Customization.
Scenario
We started using our mighty Expense Claim form and decided that we will use custom search scope to simplify administration of expense claims. Using search helps us output expense claims where necessary and will help us present expense claims information in the appropriate manner. For example like the following:
We need to output employee name, department, claim amount and total amount of all claims we find.
Solution
Customize Search Core Results output. There is one note: in this scenario we will modify search results output for the page which is used only for selected search scope. If the idea is to customize common search results page the solution is to use conditional output in XSL.
1. We have to edit search core results XSL. Go to Site Actions -> Edit Page -> Search Core Results Web Part -> Modify Shared Web Part -> XSL Editor:
2. In the Text Entry copy all text and paste it into the XML editor:
3. In the XML editor locate the element <xsl:template name="dvt_1.body">:
4. Add totals section to output. After the <xsl:apply-templates /> enter the following text:
<div class="srch-Title">
Total expenses: <xsl:value-of select="sum(//claimstotal)" />
</div>
In this scenario the idea is to use standard SharePoint styles to output information. Therefore we will use standard CSS class names.
5. Change each result output template. Locate <xsl:template match="Result"> element:
6. In this scenario I will just remove all standard output template instructions except file title which contains link to the actual form and I will add instructions to output needed expense metadata:
7. Copy edited text from XML editor to Text Entry dialog and press Save:
8. In the Web part properties panel press OK and exit edit page mode.
9. Try to search for the expense claim using custom search scope. You can see that the output has changed from standard and displays totals as we planned:
Enjoy :)
If you have any questions in regard to implementing and customizing SharePoint Search to get more efficiency in business activities for your company or you need assistance contact us now for a consultation.
Stay tuned for more useful articles from Wylde Solutions
Scenario
We started using our mighty Expense Claim form and decided that we will use custom search scope to simplify administration of expense claims. Using search helps us output expense claims where necessary and will help us present expense claims information in the appropriate manner. For example like the following:
We need to output employee name, department, claim amount and total amount of all claims we find.
Solution
Customize Search Core Results output. There is one note: in this scenario we will modify search results output for the page which is used only for selected search scope. If the idea is to customize common search results page the solution is to use conditional output in XSL.
1. We have to edit search core results XSL. Go to Site Actions -> Edit Page -> Search Core Results Web Part -> Modify Shared Web Part -> XSL Editor:
2. In the Text Entry copy all text and paste it into the XML editor:
3. In the XML editor locate the element <xsl:template name="dvt_1.body">:
4. Add totals section to output. After the <xsl:apply-templates /> enter the following text:
<div class="srch-Title">
Total expenses: <xsl:value-of select="sum(//claimstotal)" />
</div>
In this scenario the idea is to use standard SharePoint styles to output information. Therefore we will use standard CSS class names.
5. Change each result output template. Locate <xsl:template match="Result"> element:
6. In this scenario I will just remove all standard output template instructions except file title which contains link to the actual form and I will add instructions to output needed expense metadata:
7. Copy edited text from XML editor to Text Entry dialog and press Save:
8. In the Web part properties panel press OK and exit edit page mode.
9. Try to search for the expense claim using custom search scope. You can see that the output has changed from standard and displays totals as we planned:
Enjoy :)
If you have any questions in regard to implementing and customizing SharePoint Search to get more efficiency in business activities for your company or you need assistance contact us now for a consultation.
Stay tuned for more useful articles from Wylde Solutions
Comments
Post a Comment