APC Action Applications - Home Page

Frequently Asked Questions v2


It is possible to create searchform manually in HTML. There is no possibility to create it automaticaly as it is known from AA v1.2., yet. Special possibilities for searching in multiple slice at once, searching in discussions, choosing keywords from hierarchical constants and using a multiple select box are described at other places in this FAQ.

Form example:

<form action="index.shtml" method="get" name="sf" id="sf">
  Search Author:   <input type="text" name="conds[0][created_by......]"><br>
  Search in Headline and Fulltext:  <input type="text" name="conds[1][value]">
                                    <input type="hidden" name="conds[1][operator]" value="LIKE">
                                    <input type="hidden" name="conds[1][headline........]" value="1">
                                    <input type="hidden" name="conds[1][full_text.......]" value="1">
  <input type="hidden" name="sort[0][headline........]" value="a">
  <input type="submit" value="Search" >
Let's notice:

conds --- simplified syntax

The simplified syntax is <input type="text" name="conds[i][field_id]"> (see conds[0][created_by......] in the example). It is easy and good, if you want to

conds --- extended syntax

The extended syntax sets an [operator], [value] and one or more [field_id] for each condition. See conds[1] in the example.


Contains the search phrase (like conds[1][value]="Prague"). Usually this is the only visible text box (<input type="text" name="conds[1][value]">). The search phrase may be a boolean expression, but you don"t need to think about it if you are using the standard LIKE [operator].

The phrase may contain ANDs, ORs, parenthesis ({[]}) and NOT. When the user gives apple OR cherry, she will get all items containing any or both of the two in any of the fields specified by [field_id] (see further).

Spaces are considered as AND:

Prague Spring becomes Prague AND Spring

With the standard LIKE operator this works fine: it finds all items containing both Prague and Spring at any place (not necessarily Prague space Spring).

Hyphen is considered as AND NOT if not between two letters:

North-West remains as it is, but
North -West
becomes North AND NOT West because of the space on the left of the hyphen

To avoid this behavior, use quotes or single quotes:

"Prague Spring" or "North -West"


If you don't specify it, the default operator is LIKE. You can change the default by using the defaultCondsOperator parameter (e.g. defaultCondsOperator=RLIKE). Other posibilities are:

Operator Description
= equals (or "e:=" with modifiers)
<> not equals
< less than
> more than
<= less or equals
>= more or equals
BETWEEN in interval: the [value] must contain two numerical values, comma separated
LIKE substring search (SQL: LIKE "%phrase%")
RLIKE substring which begins with phrase (SQL: LIKE "phrase%")
LLIKE substring which ends with phrase (SQL: LIKE "%phrase")
XLIKE string (SQL: LIKE "phrase")
ISNULL not set (good for boolean values - like values from checkbox)
NOTNULL is set (the field must be filled - no match for NULL or epmty string '')

date modifiers

Date values are stored in the database as UNIX timestamps (no. of seconds since 1.1.1970). You can use modifiers to convert it from human format. The modificators are written before a comparison operator separated by colon (like "d:>="). The possibilities are:

Operator modificator Example Description
d d:>= Used for english style datum transformation. If used, the "value" can be in format like "06/24/2001" or "10 September 2000" see strtotime PHP function definition
e e:>= Used for european style datum transformation. If used, the "value" can be in format like "24.12.2001"
m m:>= Used for comparison with current time. If used, the "value" is substracted from current time (time()) and result value is used in comparison. The value should be in seconds. This modifier is good for displaying items newer than two days, for example.


Specify the fields to be searched through by their IDs.


Specify the sort order by the sort[] form fields. For example:

<input type="hidden" name="sort[0][headline........]" value="a">
<input type="hidden" name="sort[1][full_text.......]" value="d">

The value is "a" for ascending and "d" for descending order. The items are sorted first by sort[0], second by sort[1] etc.
If no sort[] variable is defined, items are sorted by Publish date - descending.

It is possible to sort items not only by the value, but there is possibility to sort by 'priority' for the fields which uses 'constants' (Slice Admin -> Fields -Edit -> Constants) - like category field:

<input type="hidden" name="sort[0][category........]" value="1">
<input type="hidden" name="sort[1][unspecified.....]" value="9">

The value is "1" for ascending sorting by priority and "9" for descending order.

See another example on the APC Demo Site, where publish date field is used.

Last Edit: Aug 17 2011

<aafaq id=1769> ~ToDo: 1769 How to setup searchform? </aafaq> 

This FAQ interface was developed by Jason at Commons.ca

APC: Internet and ICTs for social justice and development APC ActionApps is a free software content management system initiated by the Association for Progressive Communications (APC)
APC - Internet and ICTs for social justice and development