[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

what's the best way to share variables between main script and template files


Hello,list,

Give my main srcipt is index.cgi,it require the two files of "header" and "footer" which are HTML templates.
Where in index.cgi:

use "header";

some logic codes...

use 'footer";


Then it'll generate a dynamic page.

My question is,how can I share the variables defined in the index.cgi between index.cgi and the two templates?

For example,I have a var in the index.cgi:

our %hash = (...);

then in the template files,I can see it by:

our $hash;
<br>$hash{'key1'}</br>

But is it the best way to use global vars for the sharing under modperl?is there any other good way?Thanks.



Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.