customizing the search form

Author Message

justin kazadi

Friday 08 August 2008 3:01:50 am

hello all,
i want to know how can i modified the default search from by adding for exemple two fields .

i wanna have samethings like this :

<form action={'/content/search'|ezurl()} method='post'>
<label>Country:</label>

<select>
<option name="countries">RDC</option>
<option>BELGIQUE</option>
<option>NORVEGE</option>
</select>

<label>Town:</label>

<select name="towns">
<option>kinshasa</option>
<option>bruxelles</option>
<option>paris</option>
</select>
<label>Tag:</label>
<input type="text" name="SearchText" />
<input type="submit" name="SearchButton" value="search" />
</form>

i have try this but it didn 't work.
i need same suggestion.
thanks in advance

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

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.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 03:42:24
Script start
Timing: Jan 19 2025 03:42:24
Module start 'layout'
Timing: Jan 19 2025 03:42:24
Module start 'content'
Timing: Jan 19 2025 03:42:25
Module end 'content'
Timing: Jan 19 2025 03:42:25
Script end

Main resources:

Total runtime0.8533 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 589.1563152.6250
Module start 'layout' 0.00550.0033 741.781339.4453
Module start 'content' 0.00880.8431 781.2266536.2578
Module end 'content' 0.85190.0014 1,317.484412.4766
Script end 0.8533  1,329.9609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3819160.0002
Check MTime0.00130.1552160.0001
Mysql Total
Database connection0.00080.088510.0008
Mysqli_queries0.798793.5979540.0148
Looping result0.00070.0827520.0000
Template Total0.812095.220.4060
Template load0.00180.210120.0009
Template processing0.810294.942320.4051
Template load and register function0.00010.015810.0001
states
state_id_array0.00270.314910.0027
state_identifier_array0.00120.136020.0006
Override
Cache load0.00140.1679220.0001
Sytem overhead
Fetch class attribute can translate value0.00060.072120.0003
Fetch class attribute name0.00170.201340.0004
XML
Image XML parsing0.00130.149120.0006
class_abstraction
Instantiating content class attribute0.00000.000940.0000
General
dbfile0.00140.1614220.0001
String conversion0.00000.001340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs