WSN Gallery
Featuresspacer Showcasespacer Reviewsspacer Demosspacer Purchasespacer Manualspacer Support
Filters
Filters
By Paul

Filters allow people to thin the display to only images which meet specific criteria. For numeric fields it will filter to where the value is greater than or equal to the one of that image. For text fields it will filter to where the value is exactly the same.

Please note that filters are by their nature an advanced topic.

To allow people to filter by a field value of a particular image, use {IMAGEFILTER[fieldname]} in your template. For example, to filter by number of comments use {IMAGEFILTER[numcomments]}.

Note that the images used in the display for this are filteradd.gif and filterremove.gif in the images subdirectory of your template set. You can customize the HTML in whatever way you like by using <a href="{IMAGEFILTERLINK[fieldname]}"><img src="{IMAGEFILTERIMAGE[fieldname]}" border="0"></a> instead of {IMAGEFILTER[fielname]}.

You can also add a custom filter (not tied to a particular image's values) with a simple text link by using <a href="{FILTERLINK[catid <,> field <,> value]}">. Replace catid with the category id number (or {CATID} where applicable), field with the field name and value with the value to filter to... for example, <a href="{FILTERLINK[1 <,> numcomments <,> 5]}">View threads from category 1 with 5 or more comments</a>

You can make a select box for it as well if you want. For example:
<form action="index.php?action=displaycat&catid={CATID}&filter=numcomments&linkfilteraction=add" method="post">
Show threads with at least
<select name="filtervalue">
<option value="removefilter">show all</option>
<option value="1">1</option>
<option value="5">5</option>
<option value="10">10</option>
</select> comment(s). <input type="submit">
</form>

Note that you can make numeric filters filter to <= instead of >= by using a filtertype=less parameter in a url. To filter between two numeric values, use filtertype=between and supply the filter value hyphen separated, like 100-200. To filter to any text that contains a term, use filtertype=contains. To filter to any text that is not equal to the specified text, use filtertype=not. You can pass the filter type as the second parameter to {IMAGEFILTERLINK}, like {IMAGEFILTERLINK[descripton <,> contains]}. It can also be passed to {FILTERLINK} as the third parameter, like {FILTERLINK[1 <,> description <,> contains]}.

Filters remain in place for a day with a cookie unless removed. To remove a filter you can use filtervalue=removefilter, and to remove all filters at once you can use filtervalue=removefilters.

Comment Filtering

In addition to images, you can also filter comments. Comments filters work the same as image filters except with COMMENT in place of IMAGE.

For comments, there's a special compound filter: {COMMENTFILTER[approved / votes]}
This is useful for filtering to comments that have at least as high of an approval percentage as the current comment.

Or, as a direct link: <a href="comments.php?id={LINKID}&commentfilteraction=add&filter=postername&filtervalue=Paul&filtertype=contains">Filter thread to Paul's posts</a>

Rating:


2.67/5 based on 9 votes. The median rating is 2.

Submitted: 07/14/04 (Edited 12/06/08)

Description: How to let your visitors filter the display of images or comments.

Views: 2069 views. Averaging 1 per day.
In the most recent 30 day period, there've been 0 views.

Previous Article | Next Article

Home    |    Features    |    Showcase    |    Reviews    |    Demos    |    Purchase    |    Manual    |    Support