A client of mine once requested that I change the look
and feel of their search results page. The client was a large company that had
decided to change the design of their SharePoint portal. The portal had a search
center which was where I needed to make the change.
This is how I did it:
First of all I needed a Core Results Web Part. You can
add a web part to your results page from the Web Parts Gallery or use the
SharePoint web part that is automatically added to each search results page.
Next I had to setup the fields (columns) I wanted to see
in the search result. To do so - open the properties of the Core results web
part and under the Results Query Options change the Selected Columns xml text.
To add a new column you need add this text to the xml before </Columns>
tag:
<Column Name="YourColumnName"/>
Save the changes and now you can start to redesign the
look and feel of the search results. The fastest way to do this is to use the
XML of the search results. To access the XML you need to add this code instead
of the XSLT code of the web part in the XSL Editor:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0"
encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:copy-of select="*"/>
</xsl:template>
</xsl:stylesheet>
Save your changes and do a test search. You will get an
XML code of the search results. Copy this code and paste it to notepad. Save the
file on your desktop and open SharePoint Designer. Connect to one of your
SharePoint sites and create a new blank ASPX page. After this go in to the
design mode of your page and add a new DataView Web Part. In the Data Source
details choose the XML files and add a new XML file. In the new opened window
browse to the file you saved before and import it to SharePoint Designer.
Once you perform this operation you'll see your file in
the XML files section. Click on this file and press "Show Data".
|