[Chameleon] variable sustitution

Julien-Samuel Lacroix jlacroix at mapgears.com
Tue Feb 23 09:51:59 EST 2010


Oh! Right!

We are using mapscript. The variable substitution will not work. You 
have to use mapscript to modify your mapfile on the fly. Remove the 
input in your template (sorry) and replace the code in your .phtml by 
the following (untested):

$oApp->CWCInitialize( $szTemplate, $szMapFile, $szContext  );
$oLayer = $oApp->moMapSession->oMap->getLayerByName('layer name');
$oLayer->set('data', "select * from localidad inner join base on
localidad.localidad=base.localidad where base.pack='your pack value'" );
$oApp->CWCExecute(array(dirname(__FILE__)."/widgets"));

Julien

Alejandro Narvaez wrote:
> Julien
> 
> Thanks for your help.
> 
> I introduce the sentence but doesn't work
> 
> The template can read and show the variable value, but the mapfile doesn't.
> 
> I am missing something or I am doing something wrong, I appreciate any help
> 
> 
> Alejandro Narváez
> 
> 
> 2010/2/22 Julien-Samuel Lacroix <jlacroix at mapgears.com 
> <mailto:jlacroix at mapgears.com>>
> 
>     Hi,
> 
>     Add the following in your template:
>     <input type="hidden" name="pack" value="[$pack$]">
> 
>     The variable you set via the code are not automatically added to
>     hidden variables of the form.
> 
>     Julien
> 
>     Alejandro Narvaez wrote:
> 
>         I am trying to use variable substitution with chameleon, but I
>         have not achieved that it works.
>         Someone might indicate how to do that.
> 
> 
>         In mapfile I introduce this sentences
> 
>         DATA "select * from localidad inner join base on
>         localidad.localidad=base.localidad where base.pack='%pack%'"
>         and, into de index.html, theese
> 
>         $oApp->CWCInitialize( $szTemplate, $szMapFile, $szContext  );
>         *$oLayer = $oApp->moMapSession->oMap->getLayerByName('layer name');*
>         *$oApp->setVar('pack', 'variable value' );*
>         $oApp->CWCExecute(array(dirname(__FILE__)."/widgets"));
> 
> 
>         thanks
> 
>         Alejandro Narváez
> 
> 
>         ------------------------------------------------------------------------
> 
>         _______________________________________________
>         Chameleon mailing list
>         Chameleon at lists.maptools.org <mailto:Chameleon at lists.maptools.org>
>         http://lists.maptools.org/mailman/listinfo/chameleon
> 
> 
>     -- 
>     Julien-Samuel Lacroix
>     Mapgears
>     http://www.mapgears.com/
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon

-- 
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/


More information about the Chameleon mailing list