To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.off-topic.geekOpen lugnet.off-topic.geek in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Off-Topic / Geek / 32
31  |  33
Subject: 
Re: Random text on a website
Newsgroups: 
lugnet.publish, lugnet.off-topic.geek
Date: 
Mon, 17 May 1999 13:14:23 GMT
Viewed: 
42 times
  
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:
  Re: Random text on a website
 
My guess is this won't work for Ed as he uses AOL. Not to mention the fact that many places won't let you submit cron jobs. (...) (26 years ago, 17-May-99, to lugnet.publish, lugnet.off-topic.geek)

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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR