0

I have tried to include the simple form on my text site but it only seems to work if you type in a keyword that isnt in any of the entries.

I have copied my code below for my search field:

 {exp:search:simple_form channel="{channel_content}" results="20" result_page="/search/results" no_result_page="/search/no-results" search_in="everywhere" where="any"}
    <input type="text" name="keywords" id="keywords" class="form-control" placeholder="Search">
    <span class="input-group-btn">
    <input type="submit" class="btn-u" value="Go" />
    </span> {/exp:search:simple_form} 

And below this is the code for the search template:

     {exp:switchee variable="{segment_2}" parse="inward"}

        {case value="no-results"}
            {search_message_no_results}
        {/case} 
        {case default="yes"}
        <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"><b><a href="{auto_path}">{title}</a></b></td>
                <td width="30%" valign="top">{excerpt}</td>
                <td width="10%" valign="top"><a href="{member_path='member/index'}">{author}</a></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>

            {if count == total_results}
                </table>
            {/if}

            {paginate}
                <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
            {/paginate}

        {/exp:search:search_results}

        {/case}

        {/exp:switchee}

I am also using the switchee add on if that helps.

Thanks Jordan

1 Answer 1

0

I have found why it wasnt displaying.

I changed this value:

result_page="/search/results"

to this value:

result_page="/search"

And now my search results have started to show. I am not sure why it works when I remove the "/results" but it has.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.