[Chameleon] How to pass variable from app.php file to template.html?

Rhys Ickeringill rhysi at omnilink.com.au
Tue Jun 28 22:33:16 EDT 2005

Hi All,

I'm trying to establish how one passes a variable from a chameleon php file
to a chameleon template.

I see [#foo.html#] allows importing of external files into the template and
[$bar$] get's substituted as by the value of $_REQUEST['bar'] during
parsing. Is there a way to get the value of $foo (in code below) to be
substituted into the parsed template? I'm guessing that I'll have to declare
$foo global, but then what?

    include( "/absolute/or/relative/path/to/chameleon.php" );

    $szTemplate = "./sample_basic.html";
    $szMapFile = "../map/chameleon.map";

    class SampleApp extends Chameleon{
        function SampleApp(){
            $this->moMapSession = new MapSession_RW;
            $this->moMapSession->setTempDir( getSessionSavePath());

    $foo = 'bar';

    $oApp =  new SampleApp();
    $oApp->registerSkin( 'skins/sample' );
    $oApp->CWCInitialize( $szTemplate, $szMapFile  );



More information about the Chameleon mailing list