Gossamer Forum
Quote Reply
Globals
I added the following to SiteHTML.pm...

sub banner {
# --------------------------------------------------------
# Returns an advertisement.
#
my $ssi = "<!--# include virtual=\"/cgi-bin/bms/adcycle.cgi?delivery=SSI&group=1\" --";
return "$ssi";
}


and then added a global called <%banner%> with the code...

sub {
&Links::SiteHTML::banner();


I added the <%banner%> tag to one of my templates but nothing shows up, but when I look in the code it says...

<!--# include virtual="/cgi-bin/bms/adcycle.cgi?delivery=SSI&group=1" --

What am I doing wrong?

(Note: The <%banner%> tag is on a CGI generated page. I also left out the end ">" in the SSI tags because this forum hides the code if you add it.)

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Globals In reply to
I'm not sure what you are trying to do.

But I do have an idea you are making it much more convoluted than it has to be.

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ


Quote Reply
Re: Globals In reply to
Basically I am trying to target banners by keyword on my search results page.

I am using Adcycle not Webadverts.

I tried asking Anthrorules for help but he said he was unwilling to help me.

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Globals In reply to
But what I see is you assigning a string to a variable, via a subroutine, calling that subroutine and assigning that to a template tag.

Where is the targeting?

Why not just create a banner template tag that does the replacements itself.

sub {
my banner_tag = qq |
<!--# include virtual=/cgi-bin/bms/adcycle.cgi?delivery=SSI&group=1&keyword=$query --"
|;
}

the above is an _idea_ and is GUARANTEED to not work <G>

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ


Quote Reply
Re: Globals In reply to
Oh yes...sorry I knew that but didnt add it to the code I provided you with.

For adcycle you need to use &keywords=$query in the query string which then calls the appropriate banner.

However it is giving me a blank space with no banner showing, but the code in showing when I go to "View Source".

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Globals In reply to
Oh.............Thankyou SO much for fixing my search problem...I seem to be getting results now!

How did you manage to fix the problem?

I owe you a beer!

Thanks...Merry Xmas!!

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Globals In reply to
hello
I do it much easier.
I do it on the way Ridesworld advise, namely:
add in the globals section the javascript that generate the advertising group.
I have for each category one group, so that there are a lot of advertising options within a category/group.
non category gets another default group (group nr 500)
and add the folowwing in my templates:

<%if cat_banner%>
<%cat_banner%>
<%endif%>
<%ifnot cat_banner%>
<%nocat_banner%>
<%endif%>


there is no easier way, thanks ridesworld


Quote Reply
Re: Globals In reply to
Thanks for the help but that isnt really what Im looking for.

I need to target my banners on search results pages (cgi pages).

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Globals In reply to
Well... first of all, the variable would most likely be $IN->param('query')

Second, this would only work _if_ you called this banner tag from within a search routine where there _is_ a query.

You might want to do something like:

sub {
my $banner_tag;
my $query = $IN->param('query');

if ($query) { ## use that as the search criteria
$banner_tag = 'some stuff';
} else {
$query = 'some_default_value' ## such as a field in the category or Link record.
$banner_tag = 'other_stuff';
}
return $banner_tag;
}


You would again really need to know if you were dealing with a category or link record, or some other sort of display page. You could limit this to search pages only either by testing the URL or more simply, by just not using it in any page that wasn't a 'search' and that had a 'query' in it ie: search_results.html and search_error.html

You'd still need to surround the <%banner_tag%> with <%if query%><%banner_tag%><%endif%>



PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ


Quote Reply
Re: Globals In reply to
Actually, you might be better off not getting fancy at all:

<%if query%>
..insert your banner code here... &keyword=<%query%>
<%endif%>

Then, you allow the template parser to insert the keywords if keywords exist. If they don't the banner code is just skipped over by the <%if...endif%> block.

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ


Quote Reply
Re: Globals In reply to
Well yes...I only want the banner to be targetted to keywords on my search_results.html and search_error.html pages so would I add that code to the query sub in search.cgi or do I just create a global with it or add it to SiteHTML.pm and create a global with code...

&Links::SiteHTML::banner();

In the above case I'd have to give the sub the name "banner" rather than just sub {

Am I getting totally mixed up here?

Thanks Pugdog!

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Globals In reply to
Well just looking at that code...I use adcycle and if the keyword used does not match with any banner account then a default banner is shown anyway so I could just use...

sub {
my $banner_tag;
my $query = $IN->param('query');

if ($query) {
$banner_tag = 'some stuff';
return $banner_tag;
}


....couldnt I ?

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Globals In reply to
Just do what I said in the last message...

<%if query%>
my_bann_code...long..url&keywords=<%query%>
<%endif%>

If you already have the <%query%> there is no need to do anything else.

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ


Quote Reply
Re: Globals In reply to
OK....I dont think I have explained myself properly.

I want to use SSI code...surely that wont work on my search results page just by using..

<%if query%>
<!--# include virtual="/cgi-bin/bms/adcycle.cgi?group=1&keywords=<%query%>--
<%endif%>

OMG...Im in shock....two individual members of Afternic.com have appraised my domain name (audio-grabber.com) at $20,000.

Im only 19 so if someone pays me $20,000 I think I will die of shock!

Only small change for you though Pugdog... :-)



Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Globals In reply to
Hi,

You can't use SSI on cgi generated pages. Does adcycle have a perl interface to generate banners?

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Globals In reply to
Yes.....Ive resorted to using IFRAME code.

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Globals In reply to
re: SSI

I don't know how I missed that :(

I didn't see the SSI call. I read it as just a banner string, since I've avoided SSI like the plague since I moved off of AOLServer. Need to look at the strings more closely :(

There are a number of threads on this SSI vs CGI .

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ