Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

Inserting Banner Ads (sorta complicated)

Quote Reply
Inserting Banner Ads (sorta complicated)
I'm going to be running GM for multiple domains (and once I'm done customizing it will be running under mod_perl). What I want is to run a banner ad at the top of each page. The banner ad doesn't run under mod_perl yet, but I expect it will shortly, in case that needs to be handled differently. But, because I'm running multiple domains, what I've done in all my templates is include a few lines like this
<%include site_header.htm%>
<%include left_links.htm%>
etc.. in all my templates, so I can modify one file whenever I need to make a change, and not have to edit 30 or 40 templates for each domain. However, I want to call my banner from this new site_header.htm template that I created.

I'm getting lost in the code for where to do a system call to the banner ad program. I've been trying to go through Parser.pm, mostly in sub _parse_tags, but if anyone has any suggestions or code to share, I'd be most appreciative.
Quote Reply
Re: [JerryP] Inserting Banner Ads (sorta complicated) In reply to
Ack, stay out of Parser.pm. =) Use a global:

banner_ad => sub { my $output = `/run/system/command`; return $output; }

and then put <%banner_ad%> where you want the output of a system command displayed.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Inserting Banner Ads (sorta complicated) In reply to
Alex,
You da man... thanks for uncomplicating my life. It's working almost perfect, just one problem though. The code that is being returned is getting parsed with left brackets being turned into & lt ; and such... so I'm printing the banner info on the page, not showing the banner...

The more I work with the program to get it ready to launch, the more I like it. Good job.
(btw - just noticed I accidentally posted this to presales, you might move this thread to discussion)

Last edited by:

JerryP: Feb 27, 2002, 9:12 AM
Quote Reply
Re: [JerryP] Inserting Banner Ads (sorta complicated) In reply to
Try changing

return $output;

to

return \$output;

Last edited by:

RedRum: Feb 27, 2002, 9:32 AM
Quote Reply
Re: [RedRum] Inserting Banner Ads (sorta complicated) In reply to
Awesome, works great, just needed to strip out a little extra code the banner system spits out. Thank you mucho grande.
Quote Reply
Re: [JerryP] Inserting Banner Ads (sorta complicated) In reply to
By the way, if it's a perl banner system, you will see much better performance if you can get it working using do/require as it doesn't involve launching a new process and loading a second perl interpreter. If it's not perl, then it doesn't matter. =)

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Inserting Banner Ads (sorta complicated) In reply to
Alex, Forgot about that... right now it hasn't been an issue for performance, but of course if we did this we would have to be careful about both systems using the same variable name... I think giving things package names would help work around that... Thanks for the reminder...

btw - did you see my note about the error in the code of the fix for the bug in incoming.pl?
Quote Reply
Re: [Alex] Inserting Banner Ads (sorta complicated) In reply to
Actually, I am having a really weird problem now with the banner ad... It seems to work fine with join.cgi and login.cgi however, once I log in, I see things like this where the banner should be...
SCALAR(0x845b1e0)
If I change the variable to something simple like <%title%>, it works right on everything, just not the banner.. Any ideas?