+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Multiple templates for search widget

Multiple templates for search widget

8 posts, 0 answered
  1. Jeff
    Jeff avatar
    118 posts
    Registered:
    08 Jul 2011
    06 Mar 2013
    Link to this post
    I added a template for my site wide search on my master page. I mapped the control through Administration > Settings > Advanced > Controls > ViewMap.

    HostType: "Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox"

    LayoutTemplatePath: "~/WidgetTemplates/SearchBox.ascx" (relative path to your template)"

    I want to add a separate search for my forums but I need it to be styled differently. How do I accomplish this? When I drop a search control on the forums page it is styled the same as the site wide search. Is there some place else I can register these layouts so they only apply to a specific search control?

  2. Jeff
    Jeff avatar
    118 posts
    Registered:
    08 Jul 2011
    10 Mar 2013
    Link to this post
    Anyone have any ideas?
  3. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    08 Dec 2016
    11 Mar 2013
    Link to this post
    Hello Jeff,

    Thnak you for using our services.

    Please note that when you map a template globally from Controls->ViewMap this template will be applied globally to all instances of the controls matching the specified HostType, throughout Sitefinity.
    If you want to apply different templates per widget you can modify directly the widget template the control, or use an external template per control. For more information about the above approach, please check this section from our documentation, I hope you find it useful.

    Greetings,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Jeff
    Jeff avatar
    118 posts
    Registered:
    08 Jul 2011
    11 Mar 2013 in reply to Boyan Barnev
    Link to this post

    Yes, I understand that setting the template from Controls->ViewMap applies the change globally. I've read through the documentation and the only other place I have found that allows me to set a search template is under Settings->Toolboxes->PageControls->Sections->Search->Tools->Search. But when I set the Layout Template to the path of my user control and save, the changes are not reflected on the frontend.

     What else can I do?

     

  5. Osman
    Osman avatar
    22 posts
    Registered:
    04 Oct 2010
    19 Aug 2014
    Link to this post

    I have exact same requirements.

     I already created a custom template for the searchbox and set the ViewMap, same as  @Jeff describes in the post. That template is for the searchbox displayed in the header and set to use a generic index.

    I also need a few more searchboxes to be placed in different regions of the page, and each would be set to use different indexes. So I'd prefer to use different placeholder text, different styles for those additional searchboxes.

    Yet, I haven't found any way to map multiple templates and use them for different purposes.

    Any update on this topic?

  6. Bonny
    Bonny avatar
    58 posts
    Registered:
    11 Nov 2016
    22 Aug 2014
    Link to this post
    Hi,

    There is a bug logged already for this and it would be fixed for the next internal build.
    The bug is that the SearchBox control doesn't have Advanced mode. In the advanced mode you will be able to specify the template of the search box.
    Does this solution suit your needs?

    Regards,
    Bonny
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  7. Osman
    Osman avatar
    22 posts
    Registered:
    04 Oct 2010
    22 Aug 2014 in reply to Bonny
    Link to this post

    Thanks Bonny! 

    Once there would be an Advanced button allowing us to define a template path for each search-box, it'll be much easier for sure.

     Right now, I embed my custom searchboxes in widget templates (i.e. blog list template) and it works. But this is not the ideal solution, just a workaround.

    If someone out there need this workaround until this bug is fixed on a stable release...

    Simply add following in your widget template:

    <sfSearch:SearchBox ID="searchBox" runat="server"
        layoutTemplatePath="~/CustomControls/Search/SearchBoxForBlogPosts.ascx"
        ResultsUrl="~/blogs/search"
        SearchIndexPipeId="9427ADE6-4F0C-63E9-AB3B-FF00002E6585" />

    And don't forget to include: 

    <%@ Register Assembly="Telerik.Sitefinity.Search.Impl" Namespace="Telerik.Sitefinity.Services.Search.Web.UI.Public" TagPrefix="sfSearch" %>

  8. Bonny
    Bonny avatar
    58 posts
    Registered:
    11 Nov 2016
    26 Aug 2014
    Link to this post
    Hello,

    Thank you for sharing this workaround.
    The advanced section for the search box will be available in the next internal build.

    Regards,
    Bonny
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
8 posts, 0 answered