How to access the Search Results template?

Posted by Community Admin on 03-Aug-2018 20:49

How to access the Search Results template?

All Replies

Posted by Community Admin on 19-Jan-2011 00:00

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

Posted by Community Admin on 19-Jan-2011 00:00

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" />

You can use LayoutTemplatePath property of the widget to map the template.

Regards,
Ivan Dimitrov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 19-Jan-2011 00:00

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

This thread is closed