Gossamer Forum
Quote Reply
include banner in cgi
As I was updating my templates in an effort to upgrade to linksSQL I came across a problem...

I can view my banner software in each page if I use SSI..., but that would require editing all 79 pages of the templates. I would like to use an include, but obviously I can not include an include and expect SSI to still work.

Is there a way to edit one page and allow my banner software "/cgi-bin/random/ads.cgi" to display? I am trying to stay away from messing with any perl until I upgrade to linksSQL fully on my site. I guess my real question is, does linksSQL have anything already built in to do this?

Sorry if this question is unclear.

Thanks,

- Jonathan
Quote Reply
Re: [jdgamble] include banner in cgi In reply to
im not a pro, but this should work....

first delete all your (static) categorie-folder on the server...
then go to you admin -> setup -> build settings
change
build index to -> index.php
build_extension to -> .php

now youre extensions ar *.php and you can

<?php
include ("your_files.html");
?>

open your categories.html in the editor and include your files...->build all ->
now your include should apear in all categories.

sorry for my bad english !

Quote Reply
Re: [imp] include banner in cgi In reply to
Never would have thought to use php... interesting...

You can't include a perl file using the include statement, but you can use virtual...

<? virtual("/cgi-bin/random/ads.cgi"); ?> <---------- this works for me...

However, I still have the problem of the cgi files (Add, Modify, etc...)
How can I include the banner in the cgi files without writing a perl subroutine?

- Jonathan
Quote Reply
Re: [jdgamble] include banner in cgi In reply to
ok, i think your extensions should be *.shtml and your in include should work.
Quote Reply
Re: [jdgamble] include banner in cgi In reply to
Not sure about this but try

<%include /full/path/to/ads.cgi%>

Note - this is not /cgi-bin/random/ads.cgi but the full path on your server.

Edit: Obviously that will be no good as it will just print out the contents of the file. I'll have another think about this.

Last edited by:

afinlr: Jul 29, 2004, 8:28 AM
Quote Reply
Re: [jdgamble] include banner in cgi In reply to
Try this:

<%LWP::Simple::get('http://www.yourdomain.com/cgi-bin/random/ads.cgi')%>
Quote Reply
Re: [afinlr] include banner in cgi In reply to
Okay...

If I include the file using the full path, it works and on all pages. However, it prints the file instead of executing it.

The LWP will work on all pages and execute. The problem is that it uses LWP. Is there a way to execute LOCALLY? Isn't there a module pre-installed I can use to execute the script locally?

Thanks for the help,

- Jonathan
Quote Reply
Re: [jdgamble] include banner in cgi In reply to
If you don't want to use LWP I think you could use
<%GT::URI::HTTP::get(http...)%>
instead.
Quote Reply
Re: [afinlr] include banner in cgi In reply to
I tired it out of curiousity and it didn't work...

Thats not what I'm trying to do anyway... LWP and the HTTP get... are modules that do not execute the files LOCALLY. I would like to include a local file, rather its php or perl, and execute it. With the capabilities of links SQL I know there is a simple way to do this I just don't know what that simple way is.

Thanks for helping,

- Jonathan
Quote Reply
Re: [jdgamble] include banner in cgi In reply to
I got it to work without messing with the internal workings of linksSQL and loading the banner locally.

In global.txt I created this sub routine:

Code:
sub banner {
#------------------------------------------------------------------my $ad; if ($ENV{'SCRIPT_NAME'} =~ /nph-build/) {
$ad = '<!--#exec cgi="/cgi-bin/random/ads.cgi" -->';
}
else {
$ad = `/my_full_paths/cgi-bin/random/ads.cgi`;
$ad =~ s,Content-type:\stext/html,,;
}
return $ad;
}


in my dump I added:
'banner' => \&banner,

And in my include_menu template I added <%banner%>. The banner works fine on every page and will change.

If this helps anyone out let me know (I'm curious)...

Meanwhile... I will be working on a way to simply insert php or other perl files into the system using a similar fashion...

Thanks for the suggestions,

- Jonathan

Last edited by:

jdgamble: Jul 29, 2004, 4:11 PM
Quote Reply
Re: [jdgamble] include banner in cgi In reply to
I don't know why the code in this forum will not show up right... I edited it and it keeps deleting my new lines...

Anyway, GT needs to fix this problem, and have simpler ways to do things like what I just wrote...

it would be nice to just say:

<%exec /cgi-bin/random/ads.cgi%>

Anyway...

- Jonathan