ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

EE 2.0 Search Results Order By Title

June 01, 2012 6:38pm

Subscribe [2]
  • #1 / Jun 01, 2012 6:38pm

    bdcads

    30 posts

    Hi
    I am trying to order my search results by Title
    but for some reason it is not working

    please let me know if there is something wrong with the code, or I cant do this
    with the built in EE 2.0 Search Module

    here is the code that I am using right now:

    <ul>
    {exp:search:search_results switch="resultRowOne|resultRowTwo" orderby="title" sort="asc" dynamic="yes"}
     <li class="{switch}"><a href="http://{auto_path}">{title}</a></li>
    {/exp:search:search_results}
    </ul>
  • #2 / Jun 04, 2012 5:25am

    Manoj Thomas

    185 posts

    The advanced search form tag allows the user to select how they want to order the results. If you don’t want to give them the option to choose, you could pass the orderby and sort_order input values in hidden input fields.

    http://ellislab.com/expressionengine/user-guide/modules/search/advanced.html

  • #3 / Jun 04, 2012 11:23am

    bdcads

    30 posts

    thanks for responding

    still not is working or not sure what I am doing wrong

    this is what I came up with, i tried including the

    <form></form>

    within the code, but still nothing

    </ul>
    {exp:search:search_results switch="resultRowOne|resultRowTwo"}
      <input type="hidden" name="orderby" id="orderby" value="title" />
      <input type="hidden" name="sort_order" id="sort_order" value="asc" /> 
      {exp:search_marker}<li class="{switch}"><a href="http://{auto_path}">{title}</a></li> {/exp:search_marker} 
    {/exp:search:search_results}
    </ul>

    I also looked at the example: http://ellislab.com/forums/viewthread/195803/ to reference from

  • #4 / Jun 04, 2012 1:39pm

    Dan Decker

    7338 posts

    Hi bdcads,

    Those inputs need to go on your search form template, not your results page. The values need to be included as part of the form submission process.

    {exp:search:simple_form channel="news"}
            <label for="keywords">Search:</label>
    
            <input type="text" name="keywords" id="keywords" value="" size="18" maxlength="100">
                    <a href="http://{path=search/index}">Advanced Search</a>
            <input type="hidden" name="orderby" id="orderby" value="title" />
            <input type="hidden" name="sort_order" id="sort_order" value="asc" />
            <input type="submit" value="submit" class="submit">
    {/exp:search:simple_form}

    That should be similar to what you need.

    Cheers,

  • #5 / Jun 04, 2012 5:07pm

    bdcads

    30 posts

    Thanks Dan, that works!! 😊
    Thanks you very much for the help

  • #6 / Jun 08, 2012 5:43pm

    Shane Eckert

    7174 posts

    Hey bdcads,

    That’s awesome! Glad to hear it! Dan rocks!

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases