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.

no result message help

June 08, 2011 12:40am

Subscribe [2]
  • #1 / Jun 08, 2011 12:40am

    epgcaribbean

    2 posts

    I could use a hand displaying either a simple no results page or message.
    Just a conditional that says “sorry etc..” would be fine.

    I’ve got everything up and running very smoothly; with some great assistance here in the forums as well as a Lot of trial and error. I’ve been reading a lot about the different ways of doing this but I have had no success.

    Any help would be greatly appreciated.

    Here’s a link to my actual page

    http://epgcaribbean.ehclients.com/index.php/main/_sales_main


    Here’s the code that filters the results:

    <form method=“post” action=”{path=“main/_sales_main”}”>

    Property Type

    <select name=“search:property_type”>
      <option value=”“>—-—</option>
      <option value=“detached”>Detached House</option>
      <option value=“townhouse”>Townhouse</option>
      <option value=“apartment”>Apartment</option>
      <option value=“condominium”>Condominium</option>
      <option value=“commercial”>Commercial</option>
      <option value=“land”>Land</option>
    </select>

    Location

    <select name=“search:db_location”>
    <option value=”“>—-—</option>
    <option value=“West Coast”>West Coast</option>
    <option value=“South Coast”>South Coast</option>
    <option value=“Country Location”>Country Location</option>
    <option value=“Beachfront”>Beachfront</option>
    </select>

    Bedrooms

    <select name=“search:property-beds”>
    <option value=”“>—-—</option>
    <option value=“1”>1</option>
    <option value=“2”>2</option>
    <option value=“3”>3</option>
    <option value=“4”>4</option>
    <option value=“5”>5</option>
    <option value=“6”>6</option>
    <option value=“7+”>7+</option>
    </select>

    Price Range

    <select name=“search:price_range”>
    <option value=”“>—US $—</option>
    <option value=“100K-500K”>100,000-500,000</option>
    <option value=“500K-1MIL”>500,000-1,000,000</option>
    <option value=“1MIL-2MIL”>1,000,000-2,000,000</option>
    <option value=“2MIL-4MIL”>2,000,000-4,000,000</option>
    <option value=“4MIL-6MIL”>4,000,000 - 6,000,000</option>
    <option value=“6MIL PLUS”>6,000,000 +</option>
    </select>

    <input type=“submit” value=“SUBMIT” /></p>
    </form>

    And here’‘s the code for the results page.

    {exp:channel:entries channel=“listings” limit=“10” dynamic_parameters=“search:property-beds|search:db_location|search:price_range|search:property_type”}

    {exp:channel:entries channel=“listings” sort=“asc” limit=“15” disable=“member_data|trackbacks” paginate=“bottom”}
     
    <!—{entry_date format=’%F %d, %Y’} —>

    {photo1}
     
    <td>{title}</td>

    {exp:eehive_hacksaw words=“30” allow=”<b>”}
     
    {main_desc} {/exp:eehive_hacksaw}...More Info

     
    {paginate}
    {if “{total_pages}” != 1}

    Page {current_page} of {total_pages} pages {pagination_links}{/if}
    {/paginate} 
         
       
    {/exp:channel:entries}

  • #2 / Jun 08, 2011 8:48am

    tidy

    196 posts

    You can just use no_results within your channel entries loop to set content for when there are no results from that loop:

    {if no_results}
    Sorry, no results found etc.
    {/if}

    see http://ellislab.com/expressionengine/user-guide/modules/channel/conditional_variables.html#cond_if_no_results

    Your results page code has 2 channel tags at the start of it - did your code get broken up when you posted it?
    You just need the one channel entries loop there.

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

ExpressionEngine News!

#eecms, #events, #releases