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

using webadverts with multiple banners and static vs dynamic templates

Quote Reply
using webadverts with multiple banners and static vs dynamic templates
I'm going to post this here to see if there is anything I missed in my logic and also to hopefully help others in setting up linkssql to utilize multiple banners and making the process of using webadverts zones much easier for targeting banners. My problem was that I wanted to run a top full size banner, a bottom full size banner and then two buttons in a left navigation area, combined with the difference between static and dynamic pages and the related process of calling the banners from webadverts. Because of the different sizes, everything had to be done very carefully so it wouldn't screw up the page layout. And the biggest problem was dealing with static and dynamic pages differently. Here goes.

First I created a list of my templates that would call banners and determine which were dynamic and which were static. I have listed these at the bottom of this post

To call banners on dynamic pages, I used the banner function in linkssql, I just made four copies of it HTML_Templates.pm Globals area like this:
banner => \&insertadvert,
banner2 => \&insertadvert2,
banner3 => \&insertadvert3,
banner4 => \&insertadvert4

sub insertadvert {
my $ADVNoPrint = 1;
my $ADVQuery = "";
my $ad = '/www/jerry/cgi-bin/zone_name.pl`;
$ad =~ s,Content-type:\stext/html,,;
return $ad;
}

and so on for the other three, each having their own respective zone_name, one for the top banner, one for the bottom and two for the side buttons.

In the appropriate places of the dynamic templates, I simply placed the code for each, like <%banner%> or <%banner2%>, etc... That would get all the banners executed in the dynamic pages.

In my case I have a left navigation area (similar to a header or footer) that also calls banners, so I needed to make two copies of the left navigation template, one for the dynamic pages and one for the static ones. In the dynamic copy use the <%banner%> type calls. Make sure to edit each of the appropriate templates to reflect the proper calls to either static or dynamic banners and static or dynamic headers and footers (and in my case a standard left navigation area).

In the static templates (and the static copy of the left navigation area template) I did something a little different and created a new field in the Category table called AdZone where I would put whatever zone file I wanted in there, and it could easily be edited in Table Maintenance for Category table or using the mysql monitor to make changes if needed. I set it up as Char 35, max 100, not null, default zone_ROS.pl, no validation. It will always be the full name of the zone file that is used in webadverts. I'll explain the zone_ROS.pl in a minute.

Then in category.html I used
<!--#exec cgi="/cgi-bin/<%adzone%>"-->
to make sure when the pages get built they select the targeted category I want. In my case I'm working with a site that will have about 15 top level categories and those are the zones I'm using right now, however, with this setup I can pretty much target right down to a very specific page even, just by editing the table and adding the appropriate zone file in webadverts. In nph-build.cgi make sure to add
$OUT{adzone} = $category_r->{'AdZone'};
in the area marked
# Get the category info
in sub build_category_pages

The one key to everything was to make sure that nothing used the default webadverts configuration file ads.pl because that would screw up the placement of different sized banners. I think the setup I have solved that, using zone_ROS.pl as the default for the Category table AdZone field and setting it up to show whereever I didn't put something else. Also, every banner must have zones attached to it in the webadverts setup. In my case, the admin area gets pretty ugly with like 15 zones for the majority of my banners, but I can live with that minor inconvenience.

Hope this is a help to someone and I am certainly open to any logic I may have overlooked or misunderstood. I'm still building the site and it's not 100% tested, but I haven't found any problems yet. If I missed identified any pages as static or dynamic, that would help to.

Jerry

Here is the list of templates and whether they are static or dynamic.

TEMPLATE TYPE
add.html dynamic
add_error.html dynamic
add_success.html dynamic
badlink.html dynamic
badlink_error.html dynamic
badlink_success.html dynamic
category.html static
cool.html static
detailed.html static
email.html dynamic
email_error.html dynamic
error.html dynamic
footer.txt both
header.txt both
home.html static
login.html dynamic
login_success.html dynamic
maintain.html dynamic
modify.html dynamic
modify_error.html dynamic
modify_form.html dynamic
modify_link.html dynamic
new.html static
priority.html static
rate.html dynamic
rate_error.html dynamic
rate_success.html dynamic
rate_top.html dynamic
recc_success.html dynamic
recommend.html dynamic
search.html dynamic
search_error.html dynamic
search_results.html dynamic
signup_form.html dynamic
signup_success.html dynamic
validate_form.html dynamic
validate_success.html dynamic

(link.html and subcategory.html didn't call banners)
Subject Author Views Date
Post using webadverts with multiple banners and static vs dynamic templates JerryP 1558 May 13, 2000, 10:22 PM