Share » Forums » Developer » customizing the search form

customizing the search form

customizing the search form

Friday 08 August 2008 3:01:50 am - 1 reply

Author Message

Gabriel Finkelstein

Monday 11 August 2008 2:11:57 pm

I think you should better use a filter rather than a search.

Something like:

<form action='some_url' method='get'>

<label>Country:</label>
<select name="country">
<option value="xx">RDC</option>
<option value="xx">BELGIQUE</option>
<option value="xx">NORVEGE</option>
</select>

<label>Town:</label>
<select name="town">
<option value="xx">kinshasa</option>
<option value="xx">bruxelles</option>
<option value="xx">paris</option>
</select>

<label>Tag:</label>
<input type="text" name="SearchText" />
<input type="submit" name="SearchButton" value="search" />
</form>

Where:
some_url = url to a dummy node
xx = id of the town/country for the datatype you are using (if you use objectrelations, then xx = object id)

And inside the template for some_url:

{def $results=fetch(content, tree, hash( parent_node_id, 2,
                                                         attribute_filter, array('and',
                                                                   array('myclass/country','=',$view_parameters.country),
                                                                   array('myclass/town','=',$view_parameters.town),
                                                                 array('myclass/body','like',concat('*',$view_parameters.SearchText,'*')) ))}

Where myclass/country, myclass/town, myclass/body are the class and attributes where you want the search to be performed.

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu