Hello Prana
Sorry about late...
1) Instalation
This tutorial is based on the document of my current host (MediaTemple.net):
http://kb.mediatemple.net/questions/1682/Installing+PECL+extensions
You can install from the PECL repository, but the package is outdated
CLIPS - still in version 0.5.0:
http://pecl.php.net/package/clips
Therefore, I recommend getting the source of the latest version of the
extension from the official site.
First, you need to access the server console. Then type:
wget
http://phlips.sourceforge.net/downloads/clips-0.5.1.tar.gz
tar -xzf clips-0.5.1.tar.gz
cd clips-0.5.1
phpize5
./configure --with-php-config=/usr/local/php-5.x.x-x/bin/php-config
Obs.: replace php-5.x.x-x the installed version of PHP
make
cp modules/*.so ~/data/lib/php/
Note: if something goes wrong in the creation of the module, add the
directory where you will find the sources and type:
make clean
Redo the whole process with the necessary adjustments.
Edit php.ini and add the lines:
extension_dir = /home/xxxxx/users/.home/data/lib/php
extension =
clips-0.5.1.so
Restart the web server, create a test page containing the phpinfo();
and make sure the extension is displayed.
2) Use
View this file:
http://www.de-sid.com/desid.clp
It contains the engine of a quiz.
PHP reads and execute all the rules available on the "agenda".
An example usage would be:
<?php
clips_set_strategy(LEX_STRATEGY);
clips_batch("rules.clp");
clips_load_facts_from_string($_SESSION['facts']);
clips_run();
?>
Each reload, you insert new rules (coming from the session, for
example) and submitt clips of the changes.
For the point of execution of PHP in accordance with the CLIPS I
recommend use global variables:
CLIPS file:
(defglobal ?*rule-triggered* = 0)
PHP file:
$_SESSION['RuleTriggered'] = clips_get_defglobal_value("rule-triggered");
Good luck!
Ari Jr.
http://www.acimainteractive.com
http://desid.fa.utl.pt/index.php?option=com_content&task=view&id=60&Itemid=101