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.

Any Tutorials On Implementing Search?

May 20, 2008 10:41pm

Subscribe [3]
  • #1 / May 20, 2008 10:41pm

    dorich

    23 posts

    Is there any tutorial material explaining the search function.
    I found the description of the search tag but, having never implemented something like this, I was looking for some basic explanations of how the function works and what formatting (CSS) is required.

    Thanks.

  • #2 / May 21, 2008 10:36am

    grantmx

    1439 posts

    I assume you read the documentation on the code you should use to implement the search function here.  Beyond that, what questions do you have that aren’t apparent in the doc?

    You can use the default EE CSS, restyle the default EE CSS, or you can create your own.  The attributes are available in the “results” and “index” template in the “search” template group.

  • #3 / May 22, 2008 1:39am

    dorich

    23 posts

    I assume you read the documentation on the code you should use to implement the search function here.  Beyond that, what questions do you have that aren’t apparent in the doc?

    You can use the default EE CSS, restyle the default EE CSS, or you can create your own.  The attributes are available in the “results” and “index” template in the “search” template group.

    Thanks for your response.

    Yes I did look at the description for the code.

    The “knowledge gap” for me was how to get started.
    Intuitively I suspect you need to create a box into which search terms are input. How is that accomplished?
    What happens to search results, how are they presented, how are they formatted?

    I was looking for some tutorial material that addressed how to set up a search function.

  • #4 / May 22, 2008 4:03pm

    grantmx

    1439 posts

    Its actually quite straight forward.  Let me try to explain it.

    You create a basic HTML form and place a input form field for your search box and a button like so:

    <label for="keywords">Search:</label>
    
    <input type="text" name="keywords" id="keywords" value="" size="18" maxlength="100" />
    <input type="submit" value="submit" class="submit" />

    Then, for a simple search, you wrap it in EE tags:

    {exp:search:simple_form weblog="news"}
    
    <label for="keywords">Search:</label>
    
    <input type="text" name="keywords" id="keywords" value="" size="18" maxlength="100" />
    <input type="submit" value="submit" class="submit" />
    
    {/exp:search:simple_form}

    and BAM! you have a simple search form.  Just change the weblog parm in the search:simple_form tag to which ever weblog you want to search or remove weblog param and add this to search everywhere:

    {exp:search:simple_form ... search_in="everywhere"}

    Here is a complete listing of search parameters.

    Additionally, you can indicate a specific template where you want your search results to appear.  Note the “search_results” parameter. 

    By default your EE install comes with a pre-formated “Results” template in your “Search” template group.

    Hope this helps.

  • #5 / May 23, 2008 3:32am

    dorich

    23 posts

    Thanks.

    That filled the gap.

    Very much appreciated.

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

ExpressionEngine News!

#eecms, #events, #releases