I am trying to install a script from NMS that will call random images on a web site's page(s). It will go on the Template page (xyz.dwt for example) so that it will show on all pages attached to the template.
To be honest, I am lost trying to figure this out. I have created sites, added pages, configured message boards, admin'd them but I am having a time of it trying to figure this simple script out.
Just exactly what goes where? I know the .pl file goes to the cgi-bin and the random images go in a folder to be called from but, I am lost trying to configure the script.
If someone could lay it out step by step I would be most appreciative. I am doing this for a non-profit organization that is looking to see the site up by the first of the month. They are wanting to run a banner that changes with each page change or refresh that will link back to the banner's site. (ie: banner for Hannah Home linked to their site)
Thanks.
Some servers are configured to only parse SSI calls when they are in a file with an .shtml, .html, or .htm file extension, (regardless, you can instruct it to use non-standard shtml extension, see step #2).
The basic checklist is:
1. have a valid Perl/CGI script, (you should be able to call the script as a direct URL to test that it works), ie-
http://www.domain.tld/cgi-bin/script.pl
2. be sure that the server is configured to parse SSI, (if you are not the admin, ask -- if you are, check that you have the following (or similar) in the .htaccess file for the domain;
AddType text/html .shtml
AddHandler server-parsed .htm
AddHandler server-parsed .html
AddHandler server-parsed .shtml
Options Indexes FollowSymLinks Includes
3. add the following SSI "exec" tag to the document you want the script to insert the random image into-
<!--#exec cgi="/cgi-bin/script.pl" -->
Hope this helps.
#!/usr/local/bin/perl
@images = ( "http://mydomain.com/banners/1.jpg", "http://mydomain.com/banners/2.jpg", "http://mydomain.com/banners/3.jpg" );
@links = ( "http://banner1.com", "http://banner2.com", "http://banner3.com" );
$selected = int(rand(@images));
print "Content-type: text/html\n\n";
print "<A HREF=$links[$selected]><IMG SRC=$images[$selected]></A>";
exit;
Here's the HTML call (requires SSI):
<!--#include virtual="/cgi-bin/randombanner.cgi" -->
Just modify the @images & @links array as well as the HREF & IMG tags to suit your needs.