| Search Templates Examples
Added with version 2.28, you can specify a template file when using search.cgi. This means you can use different templates to display a listing in different ways. This feature can be used to have different types of content (e.g. sale vs rental). Example: Rental and Sale listings Scenario: Your listings items are either for rental or for sale, and some information only applies to rentals while other information only applies to sales. Solution: Use lfield30 to store whether a listing is "rental" or "sale", with lfield31-35 storing rental specific information and lfield35-38 storing sale specific information. To search/display only the rental listings and use a rental-specific template, use the following: <a href="$search_url$?search=1&lfield30_keyword=rental&template=_rent_result.html">View Rentals</a>Similarly, to search/display only the for-sale listings using a sale-specific template, use: <a href="$search_url$?search=1&lfield30_keyword=sale&template=_sale_result.html">View Sales</a>The _rent_result.html and _sale_result.html template files in the previous examples are files that you create, based on the _search_results.html template file. Each template file can have their own customized look and would display only the fields pertinent to either sales or rentals. |