[Cartoweb-users] passing a variable from php to map file

oliver oliver.christen at camptocamp.com
Fri May 12 02:33:03 EDT 2006


Hi Aileen,

For that you can use the layerReorder or Mapoverlay plugin. They allow user to reorder layers, change layers style and class and so on.
Depending of your needs you may have to extend that plugin.

See http://www.cartoweb.org/demos/demoPlugins.php "Layers reorder" tab for an exemple of usage.
The plugin are in the main /plugin/ folder in cartoweb
See http://www.cartoweb.org/doc_head/docbook/xhtml/dev.mapoverlay.html and http://www.cartoweb.org/doc_head/docbook/xhtml/user.layers.html#user.layers.layer_reorder

Regards
Oliver

  ----- Original Message ----- 
  From: Aileen Baylon 
  To: oliver 
  Sent: Friday, May 12, 2006 8:21 AM
  Subject: Re: [Cartoweb-users] passing a variable from php to map file


  Hi oliver!

  Thanks for your immediate reply. I was hoping more of a dynamic approach.

  Like a user will choose from a drop-down menu and the map will dynamically refesh getting the parameter from the PHP file to the map file.

  Have you done this already?


  Aileen

    ----- Original Message ----- 
    From: oliver 
    To: cartoweb-users at lists.maptools.org ; Aileen Baylon 
    Cc: 'len' 
    Sent: Friday, May 12, 2006 2:08 PM
    Subject: Re: [Cartoweb-users] passing a variable from php to map file


    Hi Aileen

    a configuration file is a simple text file containing the variable assignation, like this:

    CARTOCLIENT_BASE_URL = "http://your/path/to/cartoweb/htdocs/"

    SHAPEPATH = "/bla/bla/bla/bla"

    DB_USER   = xxxx
    DB_PASSWD = yyyy
    DB_HOST   = localhost
    DB_PORT   = 1234
    DB_NAME   = test

    then just point on this file when  launching the setup script:
    cw3setup.php --install --config-from-file /some/path/to/the/config/file/config_file
    the setup script will look for all files whose extension is .ini.in and replace the variable accordingly to what you seted in the configuration file.

    Regards,
    Oliver


      hi oliver.

      I'm sorry but i'm failrly new to this.
      How do you set a configuration file containing the variable replacement values?

      I would appreciate any help.

      Aileen


        Hi Aileen,

        by 'passing a variable from php to a map file' you mean writing some parameters to the mapfile before usage (like database connetions parameters) or  modifying the mapfile object on the fly to imediat usage?

        To write parameters you can use the install script function, change your mapfile extension to .map.in and add the variables replacement tags @YOUR_VARIABLE@ where they are needed. After that set a configuration file containing the variable replacement values. Then you just need to do a cw3setup.php --install --config-from-file path_to_and_name_of_the_config_file

        If you need to modify the mapfile object on the fly, you can have a look at the plugin Outline, in ServerOutline.php 

        $msMapObj = $this->serverContext->getMapObj(); this will get you the map object
        then its just a question of using phpmapscript functions and properties: http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/referencemanual-all-pages

        there are some exemple of usage in ServerOutline.php to access, create, modify and remove elements (layers, style, class, ... )

        Regards
        Oliver


          Hi,

          We are having trouble passing a variable from php to a map file.

          How do you declare this in php?
          How do you catch this in the map file?

          We want to pass the "source_id" & "target_id" to the mapfile?
          we are still on the R&D stage and we are trying to customize the demoPlugin but with our data?

          Any help will be much appreciated.


          Aileen


----------------------------------------------------------------------


          _______________________________________________
          Cartoweb-users mailing list
          Cartoweb-users at lists.maptools.org
          http://lists.maptools.org/mailman/listinfo/cartoweb-users



------------------------------------------------------------------------


        No virus found in this incoming message.
        Checked by AVG Free Edition.
        Version: 7.1.392 / Virus Database: 268.5.6/337 - Release Date: 5/11/2006



----------------------------------------------------------------------------


    No virus found in this incoming message.
    Checked by AVG Free Edition.
    Version: 7.1.392 / Virus Database: 268.5.6/337 - Release Date: 5/11/2006
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20060512/0ce4ce9d/attachment-0001.html


More information about the Cartoweb-users mailing list