Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Passing variables with &load_template

Quote Reply
Passing variables with &load_template
Here's my problem: I've edited subscribe.cgi slightly to send newly-subscribed users a friendly message telling them about their subscription. For whatever reason though, I can't seem to include variables in the text (which is in a separate file in the templates directory). So I want to say, "Thanks for subscribing to $site_title" If I turn on templates, I can use the global vars, but I need templates off since I'm using the site_html.pl file. I tried using &load_template e.g.
my $msg = &load_template ('subscribe_confirm.html', { site_title => $built_site_title,
site_url => 'www.blah.com',
to_email => $to,
%globals});

It doesn't work though.. the variables just don't get passed. Ideas?

Thanks.

Quote Reply
Re: Passing variables with &load_template In reply to
This message is some confused, I think.

But, you can't call &load_templates directly if you want to use the various %global varribles.

You need to wrap the call in a subroutine and call it from HTML_Templates.pm.

You have multiple examples of how to do it in that file, just pick the routine that is closest, and clone it.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/