Note: although this example is used for creating links that point directly
to the search results of all rentals and non-rentals, it can be applied to
almost any scenario. For example, you could use it for any of the following:
- residential, commercial and farm-land listings,
- featured and not-featured listings,
- high-end and low-end listings.
1. Create a new listing field called Rental (Yes,No)
This can be done by going to the "Setup Options" --> "Setup Listing Fields".
Find a spare listing field where you can add this. In this example we'll use
field #25. Enter in the following:
Rental (Yes,No) - select drop down as the field type - make sure to click
the "Active Field" check box.
2. Now, whenever you create or modify a listing, you'll see a new dropdown
field for rentals. Input some listings into your "Listing Editor" with some
marked as "Yes" for rentals and some as as "No".
3. Download and open up your _search_query.html template page
(/templates/[industry]/_search_query.html) and add the following. (Make sure
to add this somewhere between the open <form> and closing </form>
tags.
<input type="hidden" name="lfield25_keyword" value="no">
This hidden field tells the search engine to only return those listings
which are NOT rentals.
4. Now go to your search query page in your browser. (search.cgi)
Perform a generic search (don't fill out any of the search fields, just
click search.) All of the search results for all "for sale/non rental" listings
should be displayed because of the hidden field you added. Copy and paste the search results URL from your browsers address bar. You can
now use this URL to create a link that goes directly to the search results of
all of your non rental listings. Here's an example:
<a href="the_url_you_copied_and_pasted">Click here to
view all non-rentals</a>
After uploading the newly modified templates, make sure to republish all of your
files by going to the "Setup Options" and clicking each of the four publish
buttons. This actually recreates your site's web pages based on your
new template designs.
5. Finally, you'll want to add some sort of link to all your rental listings.
To do this, just go back and repeat the above from step 3, only making "yes"
the value in the hidden field. You can then get the search results for all of
your "rental" listings and create your link based on the search results of this
URL as well!