Gossamer Forum
Home : Products : Links 2.0 : Customization :

PROBLEM SOLVED!!! CHECK IT OUT!

Quote Reply
PROBLEM SOLVED!!! CHECK IT OUT!
Hey guys....First off, I love this links script... =)

Second off: Has anyone ever had trouble getting their SSI tags called in on the cgi generated pages? Like add.html, add_success.html and so on? SSI Don't work on those pages, unless of course you want to do a bunch of crazy stuff....and I'm no scripter, so I found a perfectly awesome solution!

I was running through some scripts on the perl archive, and noticed one called "The Includer"...and checked it out....its for people that don't have SSI, and want the functions of SSI on their website...and of course, I was like ....WOW...cause I use SSI, but when I change a banner on my website, it changes on all pages that i've created, and all links pages....except of course the cgi generated pages...

So, I would simply change the banner in my text file, and then have to manually change the banner in all the cgi generated pages....add.html, add_success, modify, modify_success, search, and so on...what a pain...

BUT!!!!!!

This is the beauty of it....say for instance you want to change your bottom banner....and you have the bottombanner.txt file, that your SSI calls to update "MOST" of your pages...instead of manually editing all the rest, or of course...search this forum for snippets of code, that your can change your links all around, and hopefully it will work....or you use this simple little script, that works wonders...

I didn't design it, I'm not an advertiser, but people...this is cool as heck!! It works great!!

So, you can add a simple code into your templates, and whalla! It calls it just like SSI! Here is what tag you use to call the script:

<script src="http://yourdomain.com/cgi-bin/includer.cgi?bottombanner.txt"></script>

and here is the actual script...

#!/usr/bin/perl

##########################################################################
## ##
## The Includer ##
## ------------ ##
## by Jimmy (wordx@hotmail.com) ##
## http://www.smartCGIs.com ##
## ##
## This is a free script, if anyone sold it to you please contact me. ##
## Please DO NOT remove any of the copyrights or links to our site, ##
## they keep this CGI free for everyone. Thanks! ##
## ##
## (c) copyright 2000 The Mp3eCom Network ##
##########################################################################
#
# Instructions:
# ============
# Grab the content of any file and display it using a Javascript tag in the following format:
#
# <script src="includer.cgi?test.txt"></script>
#
# with test.txt being the file you are grabbing.
# If it's in a different directory, include the full unix path.


$file = $ENV{'QUERY_STRING'};
print "Content-type: text/html\n\n";

if($file eq "") {
print "document.writeln('<center><font color=red>Includer Error: No File Specified.</font>
');\n";
print "document.writeln('<small>Script by <a href=\"http://www.smartcgis.com\" target=\"_blank\">SmartCGIs.com</a></small></center>');\n";
exit;
}

open(DATA,"$file") || print "document.writeln('<center><font color=red>Includer Error: Could not open $file ($!).</font>
<small>Script by <a href=\"http://www.smartcgis.com\" target=\"_blank\">SmartCGIs.com</a></small></center>');";
@filecontent = <DATA>;
close(DATA);

foreach $line(@filecontent) {
chomp($line);
$line =~ s/\'/\\\'/g;
print "document.writeln('$line');\n";
}


Its so simple, just put your text file for the SSI call into your www directory, and also into your cgi-bin directory, and there you have it....

AWESOME I MUST SAY!!!! AWESOME!!!!!

Sorry, I'm so excited cause of this script, it saves me so much time it ain't funny!!!





*AuTo|V|aT|C*
Quote Reply
Re: [automatic] PROBLEM SOLVED!!! CHECK IT OUT! In reply to
This worked out perfectly for me. I just wanted to use one menu for all of my pages :) great post!
Quote Reply
Re: [automatic] PROBLEM SOLVED!!! CHECK IT OUT! In reply to
Ack... no offense to author of that script but that's a pretty insecure piece of software.... Someone could put any path they want as the query string (and possibly view it's contents), or any random command and (most likely) crash your server.

Good luck...

--Philip
Links 2.0 moderator
Quote Reply
Re: [automatic] PROBLEM SOLVED!!! CHECK IT OUT! In reply to
You can do the same job as the awesome includer.cgi in 4 lines of perl.

Laugh
Quote Reply
Re: [Paul] PROBLEM SOLVED!!! CHECK IT OUT! In reply to
automatic,

I don't think it is legal for you to post codes from a script that someone else wrote. Just so you know.
Quote Reply
Re: [automatic] PROBLEM SOLVED!!! CHECK IT OUT! In reply to
Automatic,

I beleive you can also do that by just using <%include footer.html%>
in your template pages, and it will place those in the actual page just like SSI, except it is built into the script.

You can even make it. <%include bottumbanner.txt%>.

Hope this helps.

David
Quote Reply
Re: [automatic] PROBLEM SOLVED!!! CHECK IT OUT! In reply to
I use the includer on my info.cgi and category.cgi pages to display the title_linked tag on it because it doesn't work on them as far as I can see. If anyone has an alternative solution to this can they please let me know?