[Cartoweb-users] calling a php_mapscript fonction in a client sideplugin

Mathieu Coudert m.coudert at oieau.fr
Mon Sep 11 12:00:36 EDT 2006


Hi Jonathan,

 

Indeed, it is not recommended to use php-mapscript function on the
client-side. You should create a function in the server-side and you should
use an object in order to transit your information needed on the
client-side. 

 

You can use the usual way to get your object from server-side (i.e. Client
-> Common -> Server -> Common -> Client) using methods from each side. I
will give you an exemple. But first, you have to implement the ServerCaller
method on the client side of your plugin, and the ClientResponder method on
the server side of your plugin.

 

For exemple:

Client_your_plugin.php:

 

            
.

 

     /**

     * @see ServerCaller::buildRequest()

     */

    public function buildRequest() { 

 

               $variable = new Variable();

               $variable ->var = array();

               $variable ->var = $this->an_array_var;            

         

   return $CatalogRequest;

       

    }

 

Then, you have to create a common file to unserialize your variable between
the client and the server
.(look at a common part of an existing plugin)

 

And 

Server_your_plugin.php:

 
..




 

            /**

     * @see ClientResponder::handlePreDrawing()

     */

    public function handlePreDrawing($requ) {

                        

                        $variable = new Variable();

                        $variable = $requ;

                        $variable->var =
$this->your_Server_mapscript_function(parameter);

                   

                        return $variable;

             

            }

 

 

And, to retrieve your variable in the client side of your plugin you can
use:

 

/**

     * @see ServerCaller::handleResult()

     */

    public function handleResult($result) {

            if (empty ($result))

                        return ;

 

            $variable = new Variable();

            $variable = $result;       

            
. Whatever you want
..

   }

 

 

I hope this is almost clear for you
.

 

Mathieu

  _____  

De : cartoweb-users-bounces at lists.maptools.org
[mailto:cartoweb-users-bounces at lists.maptools.org] De la part de Jonathan
Gillot
Envoyé : lundi 11 septembre 2006 12:02
À : cartoweb-users at lists.maptools.org
Objet : [Cartoweb-users] calling a php_mapscript fonction in a client
sideplugin

 

Hello,

I'm currently writing a plugins witch needs to call a php_mapscript function
in the client side, but when i include the php_mapscript.so nothing goes any
more. How  must I make? I think that i must call a function in the server
side plugin, if it is true could you give me an example? Is there another
easier way? 

thanks in advance

Jonathan Gillot

-- 
Ce message a ete verifie par  <http://www.mailscanner.info/> MailScanner
pour des virus ou des polluriels et rien de suspect n'a ete trouve. 

 

Les donnees et renseignements contenus dans ce message sont personnels,
confidentiels et privés.Toute publication, utilisation ou diffusion, meme
partielle, doit etre autorisee. 

 

Any data and information contained in this electronic mail is personal,
confidential and private. Any total or partial publication, use or
distribution must be authorized. 


-- 
Ce message a ete verifie par MailScanner pour des virus ou des polluriels et rien de suspect n'a ete trouve.

Les donnees et renseignements contenus dans ce message sont personnels, confidentiels et prives. Toute publication, utilisation ou diffusion, meme partielle, doit etre autorisee.

Any data and information contained in this electronic mail is personal, confidential and secret. Any total or partial publication, use or distribution must be authorized.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20060911/a28e2828/attachment-0001.html


More information about the Cartoweb-users mailing list