Antidot PHP API  version 0.16.0
##PHP API to simplify integration of Antidot components
 All Classes Files Functions Variables Groups Pages
AFS search query coder/decoder API

Table of Contents

Introduction

This API simplifies coding/decoding query so that query parameters can be serialized in URL and unserialized from URL. Main objective is to keep URL as readable as possible.

Snippets of code are usable as is and can be joined to build a fully functional example step by step. If you prefer you can get access to full code example full_example.php.

Query coder/decoder interface

This interface is defined to allow home made implementations (see AfsQueryCoderInterface). But it is highly recommanded to use Antidot implementation of this interface.

If it is still necessary to implement own coder/decoder, take a look at AfsCoderBase and AfsCoderInterface classes which can help saving time and avoid reimplementing existing functionalities.

Antidot query coder/decoder implementation

Basically, instance of this class (AfsQueryCoder) allows to:

Here is an example of building a query:

$coder = new AfsQueryCoder('full_example.php');
$query = $coder->build_query($_GET);

Query

From coder declared in previous section, new links can be generated. Curent query should be modified with appropriate filters and then links can be generated as shown bellow (this example is not part of the full_example.php):

$new_query = $query->add_filter('FOO', 'bar');
$link = $coder->generate_link($new_query);

With empty initial query and standard coder, generated link should correspond to:

http://FQDN/full_example.php?replies=10&filter=FOO_bar 

Next step

AFS search query API