Skip to content

Search form tag ​

Search your location via user form

The tag ​

{exp:reinos_maps_locator:search_form}

Tag Parameters ​

Below are the Tag Parameters. Those parameters can be used in the tag described above

search_id ​

set the search_id hash. This way the module will get this hash instead of using the hash from the url.

search_id=""

metric ​

set the type of metrics km or mile

metric="km"

channel ​

Give the channel(s) to search (channel short names). Separate with a pipeline (|) for multiple channels. Required: without a (valid) channel the search_result tag returns no results.

channel=""

location_field ​

Set the location field name of your input field of your form. This will be used to search against the entries. Default location_field.

location_field="location_field"

radius_field_max ​

Set the radius max field name of your input field of your form. Default radius_field_max.

radius_field_max="radius_field_max"

search_type_field ​

Set the name of the search type field of your form. That field holds one of the values radius, locality, admin_level or sub_locality. When the field is not posted, radius is used. Default search_type_field.

search_type_field="search_type_field"

search_category_field ​

Set the name of the category field of your form, that holds the categories (names or IDs) to search in. To search with more than one category (a location must then be in all selected categories), add [] to the name of the input field (e.g. <select name="search_category_field[]" multiple>); the parameter itself stays search_category_field. Default search_category_field.

search_category_field="search_category_field"

result_url ​

set the url of your result page. The search hash is added to this url. Default is the current page. The search_result tag reads the hash from the first segment after the template; when that is not the case, use its search_id parameter. A search is deleted after 2 hours, so result links are temporary.

result_url=""

status ​

Set the entry status search.

When you want to search for more than one status, use a pipeline | as separator

status="open"

form_class ​

Add a class to the form, next to the default maps-search class.

form_class=""

Tag Variables ​

Below are the Tag Variables. Those Variables can be used inside the tag described above.

location ​

the location value

{location}

radius ​

the radius value

{radius}

search_type ​

the search_type value

{search_type}

search_category:id ​

The Category id you are searching

{search_category:id}

search_category ​

If searching multiple categories, this holds a loop of data

{search_category}
    {search_category:search_category:id}
{/search_category}

Example ​

{exp:reinos_maps_locator:search_form
    metric="km"
    channel="channel_1|channel_2"
    location_field="location_field"
    radius_field_max="radius_field_max"
    search_type_field="search_type_field"
    result_url="locations/result"
}
    <label>Location to search with (this location will be geocoded</label><br>
    <input type="text" name="location_field" value="{location}"/> 
    
    <br><br>
    
    <label>Radius (only uses when the search_type is set to 'radius')</label><br>
    <select name="radius_field_max">
        <option {if radius == 20}selected{/if} value="20">20</option>
        <option {if radius == 50}selected{/if} value="50">50</option>
        <option {if radius == 100}selected{/if} value="100">100</option>
        <option {if radius == 5000}selected{/if} value="5000">5000</option>
    </select>
    
    <br><br>
    
    <label>Search type</label><br>
    <select name="search_type_field">
        <option {if search_type == 'radius'}selected{/if} value="radius">Radius</option>
        <option {if search_type == 'locality'}selected{/if} value="locality">Within a City</option>
        <option {if search_type == 'admin_level'}selected{/if} value="admin_level">Within a state or province</option>
        <option {if search_type == 'sub_locality'}selected{/if} value="sub_locality">Within a city_district</option>
    </select>
    
    <br><br>
    
    <input type="submit"/>
{/exp:reinos_maps_locator:search_form}