Viewer Search Engines
CMS Builder makes it easy to quickly create custom search
engines.
Search
Field Format
You create a basic
search engine by entering the name of the field you want
to search followed by
the type of search you want to do, then adding that to the
url or search form.
Format |
Search
Type |
Notes |
fieldname |
Exact
Match |
|
fieldname_match |
Exact
Match |
|
fieldname_keyword |
Contains
Keyword |
|
fieldname_min |
Minimum
Value |
For
numeric searches |
fieldname_max |
Maximum
Value |
For
numeric searches |
fieldname_year |
Year
Number |
For
date searches (since v1.08) |
fieldname_month |
Month
Number |
For
date searches (since v1.08) |
fieldname_day |
Day
of Year |
For
date searches (since v1.08) |
Tip: You can combine date searches with other types of
searches. For example 'articleList.php?date_year_min=2005'
would show all articles with a date of 2005 or later.
Basic
Url Search
You can create a special
link that only lists specific records. Just add a ("?")
after your url, following
by the search conditions (fieldname=value).
| Example:
listViewer.php?color=blue |
Multiple search conditions
can be combined with ("&").
| Example:
listViewer.php?color=blue&size=XXL |
Note that if 'where'
clause is specified in the list options then any form field
keywords will be ignored.
Multi-field
Search
You can search multiple
fields just as easy as one field. Just create a comma seperated
list of fields followed
by the search prefix.
Example: articleList.php?title,summary,content_keyword=Vancouver
Custom
Search Forms
You can create search
forms by naming the fields after what you want them to search.
Here is a simple search
form that searches the "title" field for a keyword.
| <form
method="POST" action=""> |
| <input
type="text" name="title_keyword" value=""> |
| <input
type="submit" name="submit" value="Search"> |
| </form> |
SEO Search
Urls (Advanced)
Many servers support
having extra "Path Info" after the url like this: "viewer.php/size-3/".
This makes it appear
as if a page or directory exists even if it doesn't and
is great for search engine optimization.
The format is the same
as for "Basic Url Searches" except instead of = you use
- and instead of & you use /. Here's the same example
as above:
| Example:
listViewer.php/color-blue/size-XXL/ |
The quickest way to determine
if your server support "Path Info" searches is to try one.
Servers that don't support it will give a not found or other
error message.
MySql
WHERE Searches (advanced)
If you are comfortable
with MySql you can specify a custom MySql WHERE clause in
List Viewer options.
Note that any form field keywords will be ignored if a 'where'
option is specified. Example:
| Example:
$options['where'] = 'price >= 250000 AND bedrooms
= 2'; |
| Tip:
If you want to ignore any form field keywords and ALWAYS
display all records (such as when you have multiple
viewers on a page) then set |
| $options['where']
= '1'; |
| in
your list viewer options. This condition is always true
and therefore will return all records. |