Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Garret 69 posts 309 karma points
    Feb 11, 2013 @ 20:20
    Garret
    0

    Typedsearch in 6.0.0

    Hi All,

    How can I use th typedsearch() in Umbraco 6.0.0. whether as a PartialViewMacro or .cshtml Scripting File

    Code that i currently am trying:

    @{
    string query = Request["q"];
    }
    <p>test @query</p>
    <ul>
    @foreach(var page in @Umbraco.TypedSearch(@query)){
     <li><a href="@page.NiceUrl">@page.Name</a></li>
    }
    </ul>

     

    Thnx in advance,

    Garret

  • RolandWolters 42 posts 63 karma points
    Feb 11, 2013 @ 20:25
    RolandWolters
    0

    Yes! I am struggeling with that too!

  • Garret 69 posts 309 karma points
    Feb 11, 2013 @ 21:00
    Garret
    100

    Found it!

    <p>test @query</p>
    <ul class="search-results">
    @foreach(var page in @Library.Search(@query).Where("Visible")){
     <li><a href="@page.NiceUrl">@page.Name</a></li>
    }
    </ul>
  • Matt Barlow | jacker.io 164 posts 740 karma points c-trib
    May 14, 2013 @ 11:54
    Matt Barlow | jacker.io
    0

    Pretty sure you're supposed to use the "Umbraco" helper in version 6, at least in MVC anyway. This works for me:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
    var result = Umbraco.TypedSearch("searchterm");
    foreach (var page in result)
    {
    @page.Name
    }
    }

    Source:

    http://umbraco.com/follow-us/blog-archive/2012/10/30/getting-started-with-mvc-in-umbraco-410.aspx

Please Sign in or register to post replies

Write your reply to:

Draft