filter

filter

The filter function follows a similar pattern to the data function (now deprecated). When the id param is specified as one of the IDs you wish to filter by, the return will be the value of that particular filter.

The default parameter is what will be returned if there is no value specified for the filter. The further nested catch is similar but instead of returning the value when blank it returns the value on a match.

With regards to the if parameter, when the result is true, the if_true param will be rendered, but if the result is false the if_false param is rendered.

Example

[%FILTER ID:'keywords' if:'ne' value:''%]
    [%param if_true%]
        <h1 class="page-header">
            Search [@config:website_name@]
        </h1>
        <div class="search-results-search">
            <form class="" name="productsearch" method="get" action="/">
                <input type="hidden" name="rf" value="kw" />
                <div class="input-group">
                    <input class="form-control input-lg ajax_search" id="name_search" autocomplete="off" name="kw" value="[%NOHTML%][%FILTER ID:'keywords'/%][%/NOHTML%]" type="search"/>
                    <span class="input-group-btn">
                        <button type="submit" value="Search" class="btn btn-lg btn-default"><i class="fa fa-search"></i></button>
                    </span>
                </div>
            </form>
        </div>
    [%/ param%]
    [%param if_false%]
        <h1>
            [%url_info name:'page_heading' if:'eq' value:''%]
                [%PARAM if_true%]
                    [@name@]
                [%/PARAM%]
                [%PARAM if_false%]
                    [%url_info name:'page_heading'%][%end url_info%]
                [%/PARAM%]
            [%/url_info%]
            [%DATA ID:'id' if:'eq' value:''%]
                [%FILTER ID:'keywords' if:'ne' value:''%][%NOHTML%][%FILTER ID:'keywords'/%][%/NOHTML%][%/FILTER%]
            [%/DATA%]
        </h1>
    [%/ param%]
[%/FILTER%]

This would return the value searched for in the input.

filter parameters

Name Options Description
id:'' String The ID of filter you'd like to return values for
if:'' ==,!=,eq,ne,<,>,<=,>=,or,and, An optional statement to perform if logic on the filter ID results
value:'' String The value to perform the optional logic on

Was this article useful?

Be notified when this page is updated. Optional.