How to access the Search Results template?
First of all, a big thank you goes to Telerik for giving us easy access to widget templates. This has been a huge help to me and my team!
We are running Sitefinity 4.0 and are wanting to change the layout for the search results. I don't see any template of this kind in Design -> Widget Templates, and I've also tried looking in App_Data\Sitefinity\WebsiteTemplates\DefaultTemplate\ControlTemplates but couldn't find anything there as well. Where can I find an example of a template for the Search Results widget? Or better yet, where can I find the exact template that is used by Sitefinity as a default when displaying Search Results?
Thanks,
Ann
Hello Ann,
Here is the template of the public SearchResults control
<%@ Control Language="C#" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Services.Search.Web.UI.Public" TagPrefix="sfSearch" %>
<
sfSearch:SearchBox
ID
=
"topSearchBox"
runat
=
"server"
/>
<
sitefinity:SitefinityLabel
id
=
"resultsStats"
runat
=
"server"
WrapperTagName
=
"p"
CssClass
=
"sfsearchResultStatistics"
Text="<%$Resources:SearchResources, SearchResultsStatusMessage %>" />
<
asp:Repeater
ID
=
"resultsList"
runat
=
"server"
>
<
HeaderTemplate
>
<
dl
class
=
"sfsearchResultsWrp sfsearchReultTitleSnippetUrl"
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
dt
class
=
"sfsearchResultTitle"
><
a
runat
=
"server"
href='<%# Eval("Link")%>'><%# Eval("Title") %></
a
></
dt
>
<
dd
class
=
"sfsearchResultSnippet"
><%# Eval("Summary")%></
dd
>
<
dd
class
=
"sfsearchResultUrl"
><
a
runat
=
"server"
href='<%# Eval("Link")%>'><%# Eval("Link")%></
a
></
dd
>
<
dd
class
=
"sfsearchResultHighLighter"
><%# Eval("HighLighterResult")%></
dd
>
</
ItemTemplate
>
<
FooterTemplate
>
</
dl
>
</
FooterTemplate
>
</
asp:Repeater
>
<
sitefinity:Pager
ID
=
"pager"
runat
=
"server"
/>
<
sfSearch:SearchBox
ID
=
"bottomSearchBox"
runat
=
"server"
/>
Thanks for your prompt reply, Ivan. This was exactly what I was working for. I just pasted the code into the UI to create a new template for search results (list) and then applied this template to my search results widget.
Thanks again,
Ann