Forums / Developer / How to start (filtering)?
Vicente Olivan
Monday 21 July 2008 2:53:28 am
At the news folder I created a form to filter the news by: - day - month - year - group (attribute class options list [selection]) - type (attribute class options list [selection])- area (other folder)
<form> <fieldset> <legend>by Date</legend> <label for="Day" class="hide">Dia</label> <select title="{'Day'|i18n( 'design/.../node/view/full' )|wash()}"> <option value="">Any</option> ... </select> <label for="Month" class="hide">Mes</label> <select title="{'Month'|i18n( 'design/.../node/view/full' )|wash()}"> <option value="">Any</option> ... </select> <label for="Year" class="hide">Año</label> <select title="{'Year'|i18n( 'design/.../node/view/full' )|wash()}"> <option value="">Any</option> ... </select> </fieldset> <fieldset> <legend>by Group</legend> <select title="{'by Group'|i18n( 'design/.../node/view/full' )|wash()}"> <option value="">Any</option> ... </select> </fieldset> <fieldset> <legend>by Type</legend> <select title="{'by Type'|i18n( 'design/.../node/view/full' )|wash()}"> <option value="">Any</option> ... </select> </fieldset> <fieldset> <legend>by Area</legend> {def $areas=fetch( 'content', 'list', hash( 'parent_node_id', 176 ) )} <select title="{'by Area'|i18n( 'design/.../node/view/full' )|wash()}"> <option value="">Any</option> {foreach $areas as $area} <option value="{$area.name}">{$area.name}</option> {/foreach} </select> </fieldset> <input id="boboton" name="boton" type="submit" value="Show" title="{'Show'|i18n( 'design/.../node/view/full' )|wash()}"> </form>
My questions are: - What is the action/metod to use? - How to fetch date? 1, 2, 3, 4... January, February, March... 2000, 2001, 2002... - How to fetch options selection attribute? - Is the right way to do this? - Another way? - Do I think correctly?Thanks in advance.
André R.
Monday 21 July 2008 5:43:54 am
One important part is to use the view cache system, so in some way you need to pass these filters as user parameters aka "mysite/myfolder/newsfolder/(filter1)/filtervalue/(filter2)/filtervalue".
- What is the action/metod to use?
two methods to transform the post into user parameters: 1. javascript 2. (havn't tested this but seems possible) use the DestinationURL action in content/actionshould work with something like this(notice the name):
<fieldset> <legend>by Date</legend> <label for="my_filter_form_day" class="hide">Dia</label> <select name="(day)" id="my_filter_form_day" title="{'Day'|i18n( 'design/.../node/view/full' )|wash()}"> <option value="">Any</option> ... </select>
- How to fetch options selection attribute?
{def $option_array = $node.data_map.<selection_attribute>.content} {foreach $node.data_map.<selection_attribute>.class_content.options as $option} {if $option_array|contains( $option.identifier )}{$option.name|wash(xhtml)}{/if} {/foreach}
eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription @: http://twitter.com/andrerom