On Thu, Sep 20, 2001 at 12:04:27PM -0400, Rustagi, Dhiraj wrote:
> All,
> 
> I want to load a HTML file as a include in all my files and I want to pass
> parameters to this file (like query string) so that this file's Javascript
> code can use these paraemeters. Can I do this using HTML::TEMPLATE or SSI? I
> know that we can simply include a file but is there a capability to pass
> parameters to a include file?


You cannot pass parameters to an include file.

You could, however, use template variables for that.

in perl

my $t = HTML::Template->new(...);
$t->param('jsVariable', $some_variable);


in your javascript code:

var jsVariable = <TMPL_VAR name="jsVariable">;

and voila!

Since you would not want your javascript code to be buggy, due to missing
variables, you may want to associate an object (so you can set default
values) instead of setting params directly in perl... Or just make sure all
required variables are set... or use the query method of HTML::Template to
figure out what's required...

Lots of options for what, I think, you want to do.  I recommend, as always,
reading the manual closely.

-Gyepi

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to