|
Ed Jones (edboxer@aol.com) wrote:
> I have a file of quotes (an HTML Table) that I want to use on one of my
> webpages. However, I want only one quote to display randomly when a page is
> accessed. Anyone have a Java or other applet for this they could share?
What about using SSI[1] or something like that to include a
file with the quote, and then update the file one an hour
with a cron job?
You could also let the cron job put together the actual page
people download if you don't want to use SSI.
Here's how I would implement it:
------------------------------------------------------------
-- Script to update page with quote.
--
-- Quotes are stored in files named:
-- quote/1
-- quote/2
-- ...
--
-- The part of the page preceding the quote is stored in:
-- page.before_quote
--
-- The part of the page after the quote is stored in:
-- page.after_quote
#!/bin/tcsh
set last_quote=`cat quote_index`
set new_quote=`awk "BEGIN{ print $last_quote + 1 }"`
if ( ! -e quotes/$new_quote ) set new_quote=1
cat page.before_quote quotes/$new_quote page.after_quote > page.html
echo $new_quote > quote_index
------------------------------------------------------------
-- Crontab entry:
* 0 * * * /home/boxer/bin/update_quote
------------------------------------------------------------
Play well,
Jacob
1) SSI = Server Side Includes
------------------------------------------------
-- E-mail: sparre@cats.nbi.dk --
-- Web...: <URL:http://www.ldraw.org/FAQ/> --
------------------------------------------------
|
|
Message has 1 Reply:
Message is in Reply To:
| | Random text on a website
|
| I have a file of quotes (an HTML Table) that I want to use on one of my webpages. However, I want only one quote to display randomly when a page is accessed. Anyone have a Java or other applet for this they could share? (26 years ago, 17-May-99, to lugnet.publish, lugnet.off-topic.geek)
|
6 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|