Genb web content management system for use with Macromedia® Dreamweaver®
GenB by Inte. Web content management system wcms  cat  cas  eng
home|documentation|contact us product|key benefits|10 reasons|contract & pricing|faq
  resellers|references|online demo
Documentation
 download user manual (380.9 KB)
 download integrator manual (640.9 KB)

follow GenB on twitter GenB Changelog now on twitter
 integrator manual
 introduction
 documentation
 introduction to GenB
 installation
 where to start
 instructions common to all GenB modules
 particularitities of each GenB module
 XML import and export
 user manual

 
set up filters in list views

the use of filters in list views allows consultation or searches in such a way that the resulting records comply with a series of conditions.

the use of filters allows you to obtain lists that comply with conditions, such as e.g.:
-. list records ... with "date" greater than ...
-. list records ... That have in the "title" field the password ...
-. list records ... Wit the "name" field = ...
-. list records ... Where the field "price" > ...

    setting up filtres in lists is common to the modules:
  • News.
  • Registries.
  • Newsletters.
  • Generics.
  • Products.

how to define filters

to use filters in lists it is necessary to provide the parameters for definition of the filter prior to construction of the list. br/>
the parameters for definition of the filter can be sent by one of the following methods (or combination of them):

1.- sending the parameters in the same URL that will call the list. e.g.: (to consult the INTE news having a date greater than: 3/1/2003) index.php?date=20030301&scm_date=gt

2.- by sending the filter parameters using a form:

< form action="http://www.inte.es/eng/actualitat/index.php">
< input type="text" name="date" value="2003-03-01">
< input type="text" name="scm_date" value="gt">
< input type="submit" value="search">



3.- setting the parameters on the same list page. e.g:
< ?php 
$_REQUEST['date'] = '2003-03-01';
$_REQUEST['scm_date'] = 'gt';

# Configuration
$uid = '123412341234123412341234';
$NewsListLanguage='2';
$NewsListNumItems='3';
$NewsListNumLinks='5';

include_once('genb/Cnews.inc');

## new class news list
$news_list = new Cnews($uid,$NewsListLanguage,$NewsListNumItems,$NewsListNumLinks);

? >
< HTML>
< HEAD>
...
...

filter definition parameters

there are three types of parameters that can be used to define filters:



1.- the field/label variable to be used in the filter. This variable is in charge of transporting the value to be used in the filter (e.g., the data after which you will be able to see the news index.php?date=20030301 ...). You can use the following types of field:



variable or defined data template fields:

-. text: designate using the label.

-. short text: designar utilizando etiqueta.

-. open list: designate using the label.

-. closed list: designate using the label.



fixed fields:

-. internal name or reference: designate as "internal_ref".

-. date: designate as "date".

-. record creation date: designate as "date_ini".

-. record modification date: designate as "date_mod".



2.- the variable that specifies the type of filter. When a filter is set up you must indicate the way in which the contents of the filter are to be compared with the values stored in the set of records managed by the system.



the name of the parameter in charge of indicating the type of filter is constructed by adding the prefix "scm_" (search comand method) to the name of the field or label used in the filter.



e.g., if you wish to obtain the set of records having the "date" greater than "2003-03-03", the parameter that indicates the type of filter has the name "scm_date".



the various values (types of filter) that the scm_.variables.. can take are: -.neq: not equal to...

-.eq: equal to...

-.gt: greater than...

-.gte: greater than or equal to...

-.lt: less than...

-.lte: less than or equal to ...

-.cn: [default value] contains...

-.bw: between two commas sepparated values

-.ew: ends with ...

-.sw: starts with ...

-.in: (in) is in the list of values separated by commas ...

-.nin: not in: Is not in the list of values separated by commas



NOTE: filters on 'closed list' fields only admit in and ninfilters. In filters with 'closed list' type fields, always use the value of the list item identifier, never the text content.



3.- 's_field_operator' the varible that specifies the type of union between different filters. When you use more than one filter at the same time the union operator 'AND' is applied by default. Indicating that all the filters must be given in the resulting set of items.



the various values (type of operator between filter) that the variable 's_field_operator' can take are:

-.or: compliance of one of the filters in each record is sufficient.

-.and: compliance of all the filters is necessary for each one of the resulting records.

some examples of how to apply filters

some examples of how to apply filters to the lists are described below (by way of example the inte news list is used:



1.- list of news items bearing 'date' > 1-1-2003:



index.php?date=2003-01-01&scm_date=gt



2.- list of news items where 'date' is > 1-1-2003 and the body of the news 'Text' contains 'GenB':



index.php?date=2003-01-01&scm_date=gt&Text=GenB



NOTE: it is not necessary to specify scm_Text=cn since this type of filter is used by default.



3.- list of news items where 'date' > 1-1-2003 or the body of the news 'Text' contains 'GenB':



index.php?date=2003-01-01&scm_date=gt&Text=GenB&s_field_operator=or

 
GenB
GenB powered by powered by GenB wcms
© inte. Barcelona 2004 legal notice