[Chameleon] Dynamic Button in Template

Jason Fournier jfournier at dmsolutions.ca
Mon Mar 14 13:07:01 EST 2005


Tim,

If I understand correctly you can set a variable in the Chameleon init 
file (eg, index.phtml) which can then be read by the template.  This 
will allow you to maintain the url of the calling page so that you can 
go back at anytime (assuming you have a js function or link to do so). 
To set the variable in the index.phtml you would do something like:

if( isset( $_REQUEST['back_page_url'] ) )
     $oApp->setVar( 'HISTORYPAGE', $_REQUEST['back_page_url'] );
else
{
     if( isset( $_REQUEST['historypage'] ) )
         $oApp->setVar( 'HISTORYPAGE', $_REQUEST['historypage'] );
     else
         $oApp->setVar( 'HISTORYPAGE', 'null' );
}

and then in your Chameleon template form you would place:

<input type="hidden" name="historypage" value="[$HISTORYPAGE|$]">

This assumes that your site will pass back_page_url in the url to the 
Chameleon application.  If you don't have $_REQUEST['back_page_url'] or 
$_REQUEST['historypage'] then null will be written to the hidden var and 
you can do subsequent operations based on that information (eg, hide the 
'back' button).

hth,
Jason



Pascoe,Tim [Burlington] wrote:
>         I did a quick search in the archives, but came up empty. I have 
> a Chameleon 2.0 map page which is accessed from several different 
> locations in my application, depending on what is to be mapped. I need 
> to set an HREF value on my template to return to the original page 
> requesting the map. Does this make sense? This would bypass the need for 
> a user to use the back button several times if the map had been redrawn 
> multiple times; it would jump directly to the original calling page. I 
> pass the name of the page which originally requested the map to 
> Chameleon in the FORM, but I’m not sure how I can insert this FORM value 
> into the page generated from the template. Is there a simple way to do this?
> 
> Timothy Pascoe
> 
> 
> Environment Canada / Environnement Canada
> Canada Centre for Inland Waters / Centre Canadien des Eaux Intérieures
> 867 Lakeshore Road / 867, chemin Lakeshore
> Burlington, Ontario / Burlington (Ontario)
> 
> L7R 4A6
> 
> Tel/Tél: (905) 336-6239
> Fax/Téléc: (905) 336-4699
> E-mail/C. élec: ___tim.pascoe at ec.gc.ca_ <mailto:tim.pascoe at ec.gc.ca>
> Government of Canada/Gouvernement du Canada
> 
> /This e-mail represents the opinions and views solely held by its author 
> and in no manner may be considered as representing those of his/her 
> employer./
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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