Gossamer Forum
Home : Products : DBMan : Customization :

SSI in CGI

Quote Reply
SSI in CGI
Hi, I was using WebAdverts and was able to call a SSI banner through the DBMan script but now I'm trying to use another program and can't get it to work.

I placed a regular .shtml file in my /cgi-bin/dbman/ directory to make sure the program works and it did.
<!--#include virtual="../look/ssirand.cgi?REGION=Front_Page" -->

I found some code here and used it,it didn't work when I did a search. The results were that the background of the web page showing fine (image), then all the error info was smashed to the right.
www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000311.html

This is what I used.
Code:
sub include_file {
open(FILE, "/u39/staats2/cgi-bin/look/ssirand.cgi?REGION=Front_Page") or die("Couldn't open the file.");
@lines = <FILE>;
close(FILE);
foreach $line (@lines) {
print $line;
}
}

And this with closed off print statements.
&include_file;

I'v tried a dozen different ways of calling the script, absolute url ect, no luck. What is the proper url to use?

Any insight would be great, thanks
Shane

[This message has been edited by shane1800 (edited July 03, 1999).]
Quote Reply
Re: SSI in CGI In reply to
Well, I don't know a thing about SSI (which is why I didn't answer your previous question), but I can tell you how to send your characters.

Code:
if ($rec{'Main'}) {
&insertadvert(substr($rec{'Main'},3,2));
}
else {
&insertadvert([your default value]);
}

Make the first line of your subroutine

$variable = $_[0];

And use $variable in the places where you have *INSERTED HERE*.

You can name the variable anything you want within the subroutine, as long as you're consistent.

I did have a little question, since you said you wanted "the third and fourth letters of the value" and then, in the example, the letters "AA" were in the fourth and fifth position. The code above is for the fourth and fifth position, even though it's a "3." The first letter is in the "zeroth" position. But maybe you already knew that and were taking that into account.


------------------
JPD





Quote Reply
Re: SSI in CGI In reply to
Can you see anything wrong with this? Maybe I'm placing it in the wrong place, right now its after PAGE LAYOUT in html.pl.

Code:
if ($rec{'Main'}) {
&insertadvert(substr($rec{'Main'},3,2));
}
else {
&insertadvert(home);
}

sub insertadvert {
$variable = $_[0];
require "/u39/staats2/cgi-bin/ads_display.pl";
$adverts_dir = "/u39/staats2/cgi-bin/data/";
$display_cgi = "http://www.marketuplinks.com/cgi-bin/zone_$variable.pl";
$advertzone = "$variable";
$ADVUseLocking = 1;
$ADVLogIP = 0;
$DefaultBanner = "";
$ADVNoPrint = 1;
$ADVQuery = "";
&ADVsetup;
}

When I run a search nothing appears where the banner should be. I tried moving $variable = $_[0]; to other places. The banners displayed but were generic. The location of those banners were http://www.site.com/zone_.pl. The two letters 'AA' did not transfer. Maybe this has something to do with the banner script it references, if it does I'll ask somebody at their forum.

Shane

[This message has been edited by shane1800 (edited July 04, 1999).]
Quote Reply
Re: SSI in CGI In reply to
Scratch that question, I just found out that the program cost $595.00 Frown

Maybe someone can help me with this question.
When my field 'Main" is searched I would like the third and fourth letters of the value submitted to be sent to fill in the blanks for my advertisement zone script below. (the values of the main searches will always be in this form, 345AA345 or 345AA345Z or blank) I would like the AA to be sent, and if the field 'Main' is blank I would like a certain value to be sent.

Code:
sub insertadvert {
require "/u39/staats2/cgi-bin/ads_display.pl";
$adverts_dir = "/u39/staats2/cgi-bin/data/";
$display_cgi = "http://www.marketuplinks.com/cgi-bin/zone_*INSERTED HERE*.pl";
$advertzone = "*INSERTED HERE*";
$ADVUseLocking = 1;
$ADVLogIP = 0;
$DefaultBanner = "";
$ADVNoPrint = 1;
$ADVQuery = "";
&ADVsetup;
}

The code above lets me call the banner at &insertadvert, as a SSI.

Thanks Alot
Shane
Quote Reply
Re: SSI in CGI In reply to
I would put the subroutine in db.cgi and the "if-else" statement at the beginning of html_record, just after

my (%rec) = @_;

If you want it to appear on your forms, too, put it in html_record_form, too.


------------------
JPD





Quote Reply
Re: SSI in CGI In reply to
This is the only way I'v been able to successfully pass values into the banner SSI script.

At the top of htmp.pl
Code:
$html_ads = 'AA';


sub insertadvert {
require "/u39/staats2/cgi-bin/ads_display.pl";
$adverts_dir = "/u39/staats2/cgi-bin/data/";
$display_cgi = "http://www.marketuplinks.com/cgi-bin/zone_$html_ads.pl";
$advertzone = "$html_ads";
$ADVUseLocking = 1;
$ADVLogIP = 0;
$DefaultBanner = "";
$ADVNoPrint = 1;
$ADVQuery = "";
&ADVsetup;
}

Adding $variable = $_[0]; into the sub subroutine doesn't work for some reason so I don't know if the if/else statments work since nothing is passed on the the sub insertadvert. Is there a way to implement the if/else statements into what ever this thing is "$html_ads = 'AA';" since I know it works?

Thanks
Shane


[This message has been edited by shane1800 (edited July 04, 1999).]
Quote Reply
Re: SSI in CGI In reply to
You might try, just after

my (%rec) = @_;

using

Code:
if ($rec{'Main'}) {
$html_ads = (substr($rec{'Main'},3,2);
}
else {
$html_ads = [your default value];
}

&insertadvert;

------------------
JPD