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.

HELP: How to setup Search Output ?

July 11, 2007 10:56am

Subscribe [1]
  • #1 / Jul 11, 2007 10:56am

    eeuser

    10 posts

    Hi !

    I took the sample example from EE user guide, and now the question is how do i direct this result/query to an output page?
    What do I need to do?
    Could anyone show me step by step.

    Thanks

    Sample code from EE User Guide example for Search
    =======================================

    {exp:search:advanced_form result_page="search/results"}

    <table cellpadding=’4’ cellspacing=’6’ border=’0’ width=’100%’>
    <tr>
    <td>

    <fieldset class=“fieldset”>
    <legend>{lang:search_by_keyword}</legend>

    <input type=“text” class=“input” maxlength=“100” size=“40” name=“keywords” style=“width:100%;” />

    <div class=“default”>
    <select name=“search_in”>
    <option value=“titles” selected=“selected”>{lang:search_in_titles}</option>
    <option value=“entries” selected=“selected”>{lang:search_in_entries}</option>
    <option value=“everywhere” >{lang:search_everywhere}</option>
    </select>
    </div>

    <div class=“default”>
    <select name=“where”>
    <option value=“exact” selected=“selected”>{lang:exact_phrase_match}</option>
    <option value=“any”>{lang:search_any_words}</option>
    <option value=“all” >{lang:search_all_words}</option>
    <option value=“word” >{lang:search_exact_word}</option>
    </select>
    </div>

    </fieldset>

    </td><td>

    <fieldset class=“fieldset”>
    <legend>{lang:search_by_member_name}</legend>

    <input type=“text” class=“input” maxlength=“100” size=“40” name=“member_name” style=“width:100%;” />
    <div class=“default”><input type=“checkbox” class=“checkbox” name=“exact_match” value=“y” /> {lang:exact_name_match}</div>

    </fieldset>

    </td>
    </tr>
    </table>

    <table cellpadding=’4’ cellspacing=’6’ border=’0’ width=’100%’>
    <tr>
    <td valign=“top” width=“50%”>

    <table cellpadding=’0’ cellspacing=’0’ border=’0’>
    <tr>
    <td valign=“top”>

    <div class=“defaultBold”>{lang:weblogs}</div>

    <select id=“weblog_id” name=’weblog_id[]’ class=’multiselect’ size=’12’ multiple=’multiple’ onchange=’changemenu(this.selectedIndex);’>
    {weblog_names}
    </select>

    </td>
    <td valign=“top” width=“16”> </td>
    <td valign=“top”>

    <div class=“defaultBold”>{lang:categories}</div>

    <select name=’cat_id[]’ size=’12’ class=’multiselect’ multiple=’multiple’>
    <option value=’all’ selected=“selected”>{lang:any_category}</option>
    </select>

    </td>
    </tr>
    </table>

    </td>
    <td valign=“top” width=“50%”>

    <fieldset class=“fieldset”>
    <legend>{lang:search_entries_from}</legend>

    <select name=“date” [removed]>
    <option value=“0” selected=“selected”>{lang:any_date}</option>
    <option value=“1” >{lang:today_and}</option>
    <option value=“7” >{lang:this_week_and}</option>
    <option value=“30” >{lang:one_month_ago_and}</option>
    <option value=“90” >{lang:three_months_ago_and}</option>
    <option value=“180” >{lang:six_months_ago_and}</option>
    <option value=“365” >{lang:one_year_ago_and}</option>
    </select>

    <div class=“default”>
    <input type=’radio’ name=’date_order’ value=’newer’ class=’radio’ checked=“checked” /> {lang:newer}
    <input type=’radio’ name=’date_order’ value=’older’ class=’radio’ /> {lang:older}
    </div>

    </fieldset>

    <div class=“default”>
    </div>

    <fieldset class=“fieldset”>
    <legend>{lang:sort_results_by}</legend>

    <select name=“orderby”>
    <option value=“date” >{lang:date}</option>
    <option value=“title” >{lang:title}</option>
    <option value=“most_comments” >{lang:most_comments}</option>
    <option value=“recent_comment” >{lang:recent_comment}</option>
    </select>

    <div class=“default”>
    <input type=’radio’ name=’sort_order’ class=“radio” value=’desc’ checked=“checked” /> {lang:descending}
    <input type=’radio’ name=’sort_order’ class=“radio” value=’asc’ /> {lang:ascending}
    </div>

    </td>
    </tr>
    </table>

    </td>
    </tr>
    </table>

    <div class=’searchSubmit’>
    <input type=’submit’ value=’Search’ class=’submit’ />
    </div>

    {/exp:search:advanced_form}

  • #2 / Jul 11, 2007 11:58am

    Lisa Wess

    20502 posts

    Have you setup the search results path in your weblog management area? That needs to point to a template that shows a single entry - often your permalink or comment template.

  • #3 / Jul 11, 2007 12:35pm

    eeuser

    10 posts

    I am really lost I have a “Search Page Form” based on the EE example link http://expressionengine.com/docs/modules/search/index.html.

    Could show me step by step.

    I havea created a template that hold the search form and also resultpage.

    Also, I used the sample result tags from ee result user guide page.


    <table border=“0” cellpadding=“6” cellspacing=“1” width=“100%”>
    <tr>
    <th>{lang:title}</th>
    <th>{lang:excerpt}</th>
    <th>{lang:author}</th>
    <th>{lang:date}</th>
    <th>{lang:total_comments}</th>
    <th>{lang:recent_comments}</th>
    </tr>

    {exp:search:search_results switch="resultRowOne|resultRowTwo"}

    <tr class=”{switch}”>
    <td width=“30%” valign=“top”>{title}</td>
    <td width=“30%” valign=“top”>{excerpt}</td>
    <td width=“10%” valign=“top”>{author}</td>
    <td width=“10%” valign=“top”>{entry_date format="%m/%d/%y"}</td>
    <td width=“10%” valign=“top”>{comment_total}</td>
    <td width=“10%” valign=“top”>{recent_comment_date format="%m/%d/%y"}</td>
    </tr>

    {/exp:search:search_results}

    </table>

    {if paginate}

    <div class=‘paginate’>

    {page_count}  {paginate}

    </div>

    {/if}

  • #4 / Jul 11, 2007 12:40pm

    Lisa Wess

    20502 posts

    Ok, that should work except that you’re missing the final closing tag:

    {/exp:search:search_results}

    Perhaps you could tell us what isn’t working, or better yet, give us a link to the site?

  • #5 / Jul 11, 2007 12:50pm

    eeuser

    10 posts

    Here is my Entire code.

    for Search Form and I will post the Result Page Below That Please let me know why it wont display the results.. and anything else that I may have missed. Do I need to do anything on the ADMIN side if so what is it?

    =============
    SEARCH FORM
    =============

    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
    “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
    <html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=”{lang}” lang=”{lang}”>

    <head>
    <title>{lang:search}</title>

    <meta http-equiv=“content-type” content=“text/html; charset={charset}” />

    <link rel=‘stylesheet’ type=‘text/css’ media=‘all’ href=’{stylesheet=search/search_css}’ />
    <style type=‘text/css’ media=‘screen’>@import “{stylesheet=search/search_css}”;</style>

    </head>
    <body>

    <div id=‘pageheader’>
    <div class=“heading”>{lang:search_engine}</div>
    </div>

    <div id=“content”>

    <div class=‘breadcrumb’>
      {site_name} ›  {lang:search}</td>
    </div>

    <div class=‘outerBorder’>
    <div class=‘tablePad’>

    {exp:search:advanced_form result_page="search/results/" }

    <table cellpadding=‘4’ cellspacing=‘6’ border=‘0’ width=‘100%’>
    <tr>
    <td width=“50%”>

    <fieldset class=“fieldset”>
    <legend>{lang:search_by_keyword}</legend>

    <input type=“text” class=“input” maxlength=“100” size=“40” name=“keywords” style=“width:100%;” />

    <div class=“default”>
    <select name=“search_in”>
    <option value=“titles” selected=“selected”>{lang:search_in_titles}</option>
    <option value=“entries” selected=“selected”>{lang:search_in_entries}</option>
    <option value=“everywhere” >{lang:search_everywhere}</option>
    </select>

    </div>

    <div class=“default”>
    <select name=“where”>
    <option value=“exact” selected=“selected”>{lang:exact_phrase_match}</option>
    <option value=“any”>{lang:search_any_words}</option>
    <option value=“all” >{lang:search_all_words}</option>
    <option value=“word” >{lang:search_exact_word}</option>
    </select>
    </div>

    </fieldset>

    <div class=“default”>
    </div>

    <table cellpadding=‘0’ cellspacing=‘0’ border=‘0’>
    <tr>
    <td valign=“top”>

    <div class=“defaultBold”>{lang:weblogs}</div>

    <select id=“weblog_id[]” name=‘weblog_id[]’ class=‘multiselect’ size=‘12’ multiple=‘multiple’ onchange=‘changemenu(this.selectedIndex);’>
    {weblog_names}
    </select>

    </td>
    <td valign=“top” width=“16”> </td>
    <td valign=“top”>

    <div class=“defaultBold”>{lang:categories}</div>

    <select name=‘cat_id[]’ size=‘12’  class=‘multiselect’ multiple=‘multiple’>
    <option value=‘all’ selected=“selected”>{lang:any_category}</option>
    </select>

    </td>
    </tr>
    </table>

    </td><td width=“50%” valign=“top”>


    <fieldset class=“fieldset”>
    <legend>{lang:search_by_member_name}</legend>

    <input type=“text” class=“input” maxlength=“100” size=“40” name=“member_name” style=“width:100%;” />
    <div class=“default”><input type=“checkbox” class=“checkbox” name=“exact_match” value=“y”  /> {lang:exact_name_match}</div>

    </fieldset>

    <div class=“default”>
    </div>


    <fieldset class=“fieldset”>
    <legend>{lang:search_entries_from}</legend>

    <select name=“date” [removed]>
    <option value=“0” selected=“selected”>{lang:any_date}</option>
    <option value=“1” >{lang:today_and}</option>
    <option value=“7” >{lang:this_week_and}</option>
    <option value=“30” >{lang:one_month_ago_and}</option>
    <option value=“90” >{lang:three_months_ago_and}</option>
    <option value=“180” >{lang:six_months_ago_and}</option>
    <option value=“365” >{lang:one_year_ago_and}</option>
    </select>

    <div class=“default”>
    <input type=‘radio’ name=‘date_order’ value=‘newer’ class=‘radio’ checked=“checked” /> {lang:newer}
    <input type=‘radio’ name=‘date_order’ value=‘older’ class=‘radio’ /> {lang:older}
    </div>

    </fieldset>

    <div class=“default”>
    </div>

    <fieldset class=“fieldset”>
    <legend>{lang:sort_results_by}</legend>

    <select name=“order_by”>
    <option value=“date” >{lang:date}</option>
    <option value=“title” >{lang:title}</option>
    <option value=“most_comments” >{lang:most_comments}</option>
    <option value=“recent_comment” >{lang:recent_comment}</option>
    </select>

    <div class=“default”>
    <input type=‘radio’ name=‘sort_order’ class=“radio” value=‘desc’ checked=“checked” /> {lang:descending}
    <input type=‘radio’ name=‘sort_order’ class=“radio” value=‘asc’ /> {lang:ascending}
    </div>
    </fieldset>

    </td>
    </tr>
    </table>


    <div class=‘searchSubmit’>

    <input type=‘submit’ value=‘Search’ class=‘submit’ />

    </div>

    {/exp:search:advanced_form}

    <div class=‘copyright’>Powered by ExpressionEngine</div>


    </div>
    </div>
    </div>

    </body>
    </html>

  • #6 / Jul 11, 2007 12:51pm

    eeuser

    10 posts

    =======================================================================
    RESULT PAGE
    =======================================================================
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
    “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
    <html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=”{lang}” lang=”{lang}”>

    <head>
    <title>{lang:search}</title>

    <meta http-equiv=“content-type” content=“text/html; charset={charset}” />

    <link rel=‘stylesheet’ type=‘text/css’ media=‘all’ href=’{stylesheet=search/search_css}’ />
    <style type=‘text/css’ media=‘screen’>@import “{stylesheet=search/search_css}”;</style>

    </head>
    <body>

    <div id=‘pageheader’>
    <div class=“heading”>{lang:search_results}</div>
    </div>

    <div id=“content”>

    <table class=‘breadcrumb’ border=‘0’ cellpadding=‘0’ cellspacing=‘0’ width=‘99%’>
    <tr>
    <td>  {site_name} ›  {lang:search} ›  {lang:search_results}</td>
    <td align=“center”>{lang:keywords} {exp:search:keywords}</td>
    <td align=“right”>{lang:total_search_results} {exp:search:total_results}</td>
    </tr>
    </table>

    <div class=‘outerBorder’>
    <div class=‘tablePad’>

    <table border=“0” cellpadding=“6” cellspacing=“1” width=“100%”>
    <tr>
    <td class=“resultHead”>{lang:title}</td>
    <td class=“resultHead”>{lang:excerpt}</td>
    <td class=“resultHead”>{lang:author}</td>
    <td class=“resultHead”>{lang:date}</td>
    <td class=“resultHead”>{lang:total_comments}</td>
    <td class=“resultHead”>{lang:recent_comments}</td>
    </tr>

    {exp:search:search_results switch="resultRowOne|resultRowTwo"}

    <tr>
    <td class=”{switch}” width=“30%” valign=“top”>{title}</td>
    <td class=”{switch}” width=“30%” valign=“top”>{excerpt}</td>
    <td class=”{switch}” width=“10%” valign=“top”>{author}</td>
    <td class=”{switch}” width=“10%” valign=“top”>{entry_date format="%m/%d/%y"}</td>
    <td class=”{switch}” width=“10%” valign=“top”>{comment_total}</td>
    <td class=”{switch}” width=“10%” valign=“top”>{recent_comment_date format="%m/%d/%y"}</td>
    </tr>

    {/exp:search:search_results}

    </table>


    {if paginate}

    <div class=‘paginate’>

    {page_count}  {paginate}

    </div>

    {/if}


    </td>
    </tr>
    </table>

    <div class=‘copyright’>Powered by ExpressionEngine</div>

    </div>
    </div>
    </div>

    </body>
    </html>

  • #7 / Jul 11, 2007 12:54pm

    Lisa Wess

    20502 posts

    Continually re-pasting the code isn’t helping.  Did you see my first response?

    Have you setup the search results path in your weblog management area? That needs to point to a template that shows a single entry - often your permalink or comment template.

    You need to fill out the Search Results URL as explained in the docs.

    If that doesn’t help, we’ll need a link to the site. =)

  • #8 / Jul 11, 2007 1:04pm

    eeuser

    10 posts

    “Have you setup the search results path in your weblog management area? That needs to point to a template that shows a single entry - often your permalink or comment template. “

    Please bear with me I am really new to this.

    Search Form Page http://qcweb.bbh.com/fx/index.php/search/index/  <I am probably behind a firewall >

    I tried setting up a path using the following steps CP home> Admin> Weblog Management > Edit Weblog

    Search Results URL
    I pointed the path to the result page path ie http://qcweb.bbh.com/fx/index.php/search/results/

    Is that correct?

    Also, I am using the default Search that came with EE.

    Thanks much in advance

  • #9 / Jul 11, 2007 1:13pm

    Lisa Wess

    20502 posts

    No, that is not correct. The results page is for listing the search results. You want the path mentioned above to point to a single-entry template, such as a comments page.

    The search does seem to be working from here, though.  Hard to say with your content if the final link from the list of results to the individual results page is right.

  • #10 / Jul 11, 2007 2:05pm

    eeuser

    10 posts

    Thanks you for your help I was finally able to get it running along with the links.
    http://qcweb.bbh.com/fx/index.php/search/index/

    😊

  • #11 / Jul 11, 2007 2:22pm

    Lisa Wess

    20502 posts

    Good to hear it! =)

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

ExpressionEngine News!

#eecms, #events, #releases