[Chameleon] how to get %variable% passed on

Jason Fournier jfournier at dmsolutions.ca
Mon May 23 19:13:54 EDT 2005


Gustavo,

1) Custom Query Results

To produce custom query results you could follow the instructions at:

http://chameleon.maptools.org/tiki/tiki-index.php?page=QueryWidgetCustomizingResults


2) Variable Substitution

If I understand correctly you would like to update the EXPRESSION on a layer based on input from a select statement?  If this is correct then you will be required to do a little bit of coding in the index.phtml (initialization) file.

something like (untested):

// Place this function as a method in the SampleApp class

    function CWCProcessURL(&$oHTTPFormVars)
    {
        $bRes =  parent::CWCProcessURL($oHTTPFormVars);

        if( isset( $_REQUEST['select'] ) )
        {
            $oApp = GetChameleonApplication();
            $oMap = $oApp->moMapSession->oMap;
            $oLayer = @$oMap->getLayerByName( 'layer_to_place_expression_on' );
            $oClass = $oLayer->getClass( 0 ); //assumes the first class
            $oClass->setexpression( '\'[genus]\' eq \''.$_REQUEST['select'].'\'' );
        }

        return $bRes;
    }

Some of the more PHP/MapScript savvy folks on the list may have more insight for Variable Substitution in Chameleon.

hth,
Jason


Gustavo Concheiro wrote:
> Very newbie question?
> 
> I am just switching from basic HTML+MapServer to Chameleon.  I simply
> modified one of the samples, and love the results so far.  I have,
> though, a couple of things I miss:
> 
> 1. Queries.  I had nice results, formated, with only the info I wanted. 
> Now I get a dbf-dump for the shapefile.  I read the html template for
> queries, used by the MapServer CGI, is ignored by Chameleon.  The
> dbf-dump table will not do.  How do I go about changing this?
> 
> 2. I used to send a variable, say my_genus, from <select> input in the
> form, so it got replaced in the template, for filter, like 
> 
>    FILTER ('[genus]' eq '%my_genus')
> 
> so the user could either show only a selection of the items.  How do I
> reproduce this with Chameleon?
> 
> 
> TIA.
> 
> 
> -Gustavo
> 
> 
> PS: anybody knows whether there is anything wrong with DMSolutions mail?
>  I requested info on training and support, got no answer.
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
> 

-- 
________________________
Jason Fournier

DM Solutions Group Inc.
jfournier at dmsolutions.ca
www.dmsolutions.ca
613.565.5056 x18



More information about the Chameleon mailing list