Search page template tags

From Open-Realty Wiki

Jump to: navigation, search

Each tag in the template system looks like this {tag_name}.

The Search Page fields must be contained inside a form. Use the following code for your template form:

<form action="index.php" method="get">

CONTENT

<input type="hidden" name="action" value="searchresults" />

<input type="submit" />

</form>

Replace the "CONTENT" above with any formatting code and template tags you wish to use for your template. You can look at the source code for the search_page_default.html file as an example to assist you.


Custom Search Pages

It is possible to forgo using Open-Realty's somewhat limited Search Page Template system and create your own custom search forms. You will still use the initial code on the template for the form content but replace the CONTENT area with your own custom form fields and their values. If you are unfamilar with how to do this then I suggest you use Open-Realty's existing search form template

You can pass the following options to the search now. Value can be a Unix integer timestamp or an ISO format Y-m-d H:i:s

Find all listings modified last before Feb 12 2006 at midnight

&listing_last_modified_less=2006-2-12


Find all listings modified last on Feb 12 2006 at 7:30:00 PM

&listing_last_modified_equal=2006-2-12%2019:30:00


Find all listings modified last after Feb 12 2006 at 8:00:00 PM

&listing_last_modified_greater=2006-2-12%2020:00:00

Mutliple Sortby Values

Some people may want to sort listings by multiple fields. Open-Realty now supports sorting by up to 2 fields, seperated by a comma (see examples below).

For example you may want to have your listings sorted by City so all listings are grouped by their city and then sorted by price within those groups. Placing the city as the first sortby and the price as the second sortby will accomplish this. You will need to add a hidden field to your search form to add the additional sortbys to pass it to the search results string.

This example will sort listings by Featured Listings first and then by price. So all of your listings that are featured will appear first and then the rest of the listings will appear. They will all be sorted by price as well. index.php?action=searchresults&sortby=listingsdb_featured,price&sorttype=DESC,ASC

This example will sort the listings by City first and then price. All of your listings will be grouped by city and then sorted by price within those groupings. index.php?action=searchresults&sortby=city,price&sorttype=DESC,ASC


The Following tags are available from the search page templates.

Tag Description
featured_listings_NAME Renders featured listings using the featured listings template specified in place of "NAME"
browse_all_listings Renders a text link to "Browse all listings" and shows the total number of listings
search_fields This is the MOST IMPORTANT field. This displays all of the searchable listing fields. This MUST be inside the <form> </form> tags.
agent_searchbox Displays the drop down agent search box.
show_only_with_images Displays the Form check box for "Show only listings with images" on the search page.
lang_variable Displays the value for any defined lang variable. Examples: {lang_show_only_with_images} {lang_show_only_with_vtours} {lang_search_listings}
show_only_with_vtours Displays the Form check box for "Show only listings with virtual tours" on the search page.
search_type Adds a hidden field to the search form that includes the property class for the search. This is part of the new property class system of Open-Realty 2.1.
postalcode_dist_search Adds a distance search option to the search page using zip codes. The distance search functions require the use of additional data not provided by Open-Realty. See the Distance Search Database for details and instructions.
lat_long_dist_search Adds a distance search option to the search page using Latitude and Longitude positions. Your listings must have listing fields of latitude and longitude and have these values filled in already to use this feature (such as data provided by several MLS systems). Open-Realty will not Geocode an address automatically. The distance search functions require the use of additional data not provided by Open-Realty. See the Distance Search Database for details and instructions.
browse_all_listings_pclass Shows you the browse all listing link, except it links to the listings in the selected property class and shows a count of listings in the current property class. If no property class is selected it falls back to the old display_all_listing link.
full_text_search Adds a search box that will compare the users entry to all listing field values.
city_dist_search Adds a distance search option to the search page using city names. The distance search functions require the use of additional data not provided by Open-Realty. See the Distance Search Database for details and instructions.

Note: This will not be 100% accurate as some city names have multiple zip codes and some some are located in more than 1 state.

Blocks
All code contained on the template inside a block will be controlled according to the block it is contained inside. This is for template designers to control the display of many fields or code by enclosing it in one simple template tag block. A STARTING block will look like a normal template tag but that block must be closed with {/TEMPLATE_TAG} The following template tags are blocks:
templated_search_form The search form should be contained inside this block. When a call is made for the templated search form the code inside this block will be what is displayed. This is used for including the search form on pages other than the search page.
Personal tools