/    Sign up×
Community /Pin to ProfileBookmark

Rotation Banner or Image

Hop onto my site…
[URL=http://www.lpwv.org]www.lpwv.org[/URL]
See the Thomas Jefferson Quote…

Does anyone know a short script that would allow me to call several different images into that spot.

What I want is something that will call a new image everytime the site is hit…just to keep things fresh visually…Kinda like a banner rotation.

I would also like this to do the same thing (different set of images) in the “links” page of the site (the banner at the top)….

Thanks,

Mike

to post a comment
Full-stack Developer

8 Comments(s)

Copy linkTweet thisAlerts:
@the_treeMar 15.2005 — Wether you're doing this with javascript or a server scripting language such as PHP the concept is almost always the same.[list=1]
  • [*]Create an array of different file locations

  • [*]Generate a random number (the boundries, the size of the array)

  • [*]Use that random number to pick an item from the array

  • [*]Output a call to that image.

    [/list=1]
  • Copy linkTweet thisAlerts:
    @michaelswilsonauthorMar 15.2005 — Your answer, while I am sure accurate, is way over my head...

    I acutally need step by step or some code...

    Sorry...
    Copy linkTweet thisAlerts:
    @PeOfEoMar 16.2005 — [COLOR=deeppink]does your server support any server side languages?[/COLOR]
    Copy linkTweet thisAlerts:
    @michaelswilsonauthorMar 16.2005 — For a $5.00/month fee.
    Copy linkTweet thisAlerts:
    @JonaMar 16.2005 — [font=trebuchet ms]Which ones? I wrote a [url=http://www.webreference.com/programming/javascript/jf/column6/]JavaScript article on rotating images[/url] awhile ago, but you should use a server-side language for this to work for users without JavaScript.[/font]
    Copy linkTweet thisAlerts:
    @michaelswilsonauthorMar 16.2005 — This is all I could find in my server information for Server Sided Includes, I dont know if this is what you mean.

    A server side include, or SSI, is a piece of code that is embedded into an HTML page and interpreted by the the server before the page is sent to the client's browser. SSI's allow you to include information in your HTML files like a file's date of last modification, another HTML file, a counter, or the output of any CGI script.

    Server Side Includes are server intensive. Because all files need to be parsed by the server, having all of your pages SSI would cut performance.

    Any file that has the extension .shtml will automatically be parsed by the server. You can use index.shtml instead of index.html as your default directory file.

    SSI COMMANDS

    o The INCLUDE Command
    o The ECHO Command
    o The EXEC Command
    o The FSIZE Command
    o The FLASTMOD Command
    o The CONFIG Command


    SSI Commands The following is a list of Server Side Include basics: A server side include command is contained within a comment tag:

    <!--#command argument="value" -->


    Syntax must be correct, or your include will not work.

    The INCLUDE Command

    To include the contents of another file in a shtml file, you use the include command.

    The include command has two possible arguments: virtual and file.

    "Virtual" is used when the path to the document is given relative to the document root (usually your www directory.)

    "File" is used when the path to the document is given relative to the shtml file itself. However, you cannot use "file" to go up a directory ( "../slime.html" won't work.)

    Say we want to include the file named "file.html" which resides in the same sub directory of as this shtml file.

    To include it using "virtual," you would use:

    <!--#include virtual="/mirror/ssi/file.html" -->


    This would return: This is from file.html

    To include it using "file," you would use:

    <!--#include file="file.html" -->


    This would return: This is from file.html


    The ECHO Command

    The echo command includes, or "echoes," the contents of an environment variable. Here are some examples showing the SSI tag and the results :

    <!--#echo var="DOCUMENT_NAME" -->

    This document is named: man7.htm

    <!--#echo var="DATE_LOCAL" -->

    You accessed this document: Tuesday, 03-Jan-98 14:02:35 EDT

    <!--#echo var="DATE_GMT" -->

    This is the same as the above, but in Greenwich Mean Time: Tuesday, 03-Jan-98 18:02:35 EST

    <!--#echo var="DOCUMENT_URI" -->

    The URI (the path form document root) of this document is: /manual/man7.htm

    <!--#echo var="LAST_MODIFIED" -->

    This document was last modified: Friday, 01-Nov-96 15:22:57 EST

    <!--#echo var="HTTP_REFERER" -->

    The user came by way of a link from: http://www.liquidweb.com/manual/index.html

    <!--#echo var="HTTP_USER_AGENT" -->

    The browser used to access this document was: Mozilla/4.0b3 [en] (WinNT; I)

    Echo Command Values

    SERVER_SOFTWARE server application

    SERVER_NAME hostname of the server

    SERVER_PROTOCOL server protocol

    SERVER_PORT listening TCP port

    REQUEST_METHOD HTTP method used by the client

    REMOTE_HOST domain name of the client, note DNS option must be set

    REMOTE_ADDR IP address of the client

    AUTH_TYPE method that the client used for authorization

    REMOTE_USER username entered by the remote client

    CONTENT_TYPE MIME type of the content posted by the client

    CONTENT_LENGTH size of the data posted by the client

    DOCUMENT_NAME name of the document requested

    DOCUMENT_URI URL of the document requested

    DATE_LOCAL current date, format specified by the config command

    DATE_GMT The current GMT, format specified by the config command

    LAST_MODIFIED document modified date, format specified by the config command

    PAGE_COUNT number of hits on the current document since server came on-line

    TOTAL_HITS number of documents server has served since coming on-line

    REFERRER The URL of the document the viewer came from


    The EXEC Command

    The exec command executes a Unix command or CGI script. It always takes the argument "cmd".

    <!--#exec cmd="/usr/bin/date" --> This executes the Unix date command.

    <!--#exec cgi="./hello.cgi" --> This executes the CGI script, hello.cgi.


    If you look carefully you will notice the second line uses the statement exec cgi opposed to the previous line which used exec cmd. The second line is calling a CGI script that was written, the first a UNIX command. Here is the perl code contained in hello.cgi:

    #!/bin/perl

    print "Hello";

    exit;

    All the environment variables passed to the CGI script are the same as those for the shtml file itself.

    So, you cannot pass a query string using a question mark (?), as in:

    <!--#exec cmd="hello.cgi?query" -->

    The query string passed to the CGI script will be the same as the query string passed to the shtml file itself. If this file were referenced as "ssi.shtml?snort", than the word "snort" would also be passed to the "hello.cgi" script above.


    The FSIZE Command

    The fsize command returns the size of the specified file in bytes. It uses the argument "virtual," which is the path to the file is given relative to the document root (usually your www directory.)

    To find the size of picture.gif, you would use:

    <!--#fsize virtual="graphics/picture.gif" -->

    This would return then return the file size.

    Your probably now asking, what can I use this for? Example: You offer some files available for download on your site and would like to give people an idea of how big the files are.

    The FLASTMOD Command

    The flastmod command returns the date the specified file was last modified.

    The flastmod command uses the argument "virtual," which is the path to the file is given relative to the document root (usually your www directory.)

    To find the last modified date of a file, you would use:

    <!--#flastmod virtual="filename.txt" -->

    This would return: Friday, 06-Sep-96 03:36:06 EDT

    The CONFIG Command

    The config command is used to control how the results of other SSI are displayed. There are three possible arguments: timefmt, sizefmt and errmesg.

    To set the format for the date to dd/mm/yy, you will use:

    <!--#config timefmt="%d/%m/%y" -->

    The date will now be displayed as: 03/06/97

    The field descriptors used by this SSI tag are the same as those used by the Unix date command.

    Notice the dates displayed above this config command use the normal date format, the one below it uses the new format.

    To set the format for how file sizes are displayed, you use:

    <!--#config sizefmt="abbrev" -->

    or:

    <!--#config sizefmt="bytes" -->

    Depending on whether you want the size given in total bytes or abbreviated as "1k".

    To set error message returned when an SSI tag fails, use:

    <!--#config errmsg="Error" -->

    A failed SSI tag will now return: Error [/QUOTE]
    Copy linkTweet thisAlerts:
    @JonaMar 16.2005 — [font=trebuchet ms]Well you have Perl CGI it looks like, so you can ask your question there, or maybe do a PHP test and ask your question in the PHP forum. (ASP obviously wouldn't be available since 99% of the time ASP only runs on a Windows server, and Perl CGI only runs on a UNIX/Linux/FreeBSD/OS2/SunOS server, and Perl CGI rarely runs on Windows, and ASP rarely runs on UNIX.)[/font]
    Copy linkTweet thisAlerts:
    @PeOfEoMar 19.2005 — [i]Originally posted by michaelswilson [/i]

    [B]For a $5.00/month fee. [/B][/QUOTE]
    [COLOR=deeppink]SSL is not a server side language, if it says ssl they mean secure socket layer, which is 2 way encryption between the client and the server. This also has nothing to do with ssi. SSI is not going to give you the functionality you need. You really would need one of these: asp, php, cgi, asp.net, jsp, cold fusion[/COLOR]
    ×

    Success!

    Help @michaelswilson spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...