Results 1 to 2 of 2
  1. #1
    Join Date
    January 18th, 2005
    Las Vegas

    There have been many times when I've wanted to post just one or a few products (with only a title and price) somewhere on the page of a busy site. I never did this because I didn't want to run every time the was page was loaded, especially not to display that small amount of data.

    I'd like to see an option that would let me generate a static HTML page for any given output. Then, I could use a simple 'include' statement to add it to my page -- without running every time. That static page would sit there until I updated it.

    True, I could build a temporary page, run it in my browser and grab the HTML, but I'd rather give the parameters including the name of the output file. Maybe my output settings would all be in a /static folder so could find them and batch process them periodically.

    The thing is, I don't always need my products to be updated on the fly. In many cases I'd give up the dynamic updating to avoid running so often.

    Please let me know what you think. Thanks.


  2. #2
    ABW Ambassador cusimano's Avatar
    Join Date
    January 18th, 2005
    Toronto, Canada
    You can do that with a shell script (linux equivalent of a DOS batch file) and with a cronjob (linux scheduled task). And/or if you want to initiate the update from your web browser you can do that with a slightly different shell script.

    1. cronjob scheduled updating.

    Set up a cronjob entry that periodically (e.g.: 4:00AM every day) calls your shell script. In the cronjob entry, you'll have to specify the full path to your shell script. For example, on my server I might name it "update" and it might be located at /home/virtual/site9/fst/var/www/cgi-bin/update (this path equates to the URL at my site). (Even though this shell script cannot be run via a web browser, I still like to put it in an organized place such as the cgi-bin directory).

    In the shell script, you would have something like:

    /usr/bin/lynx -source "URL" > FILENAME

    The first line identifies this as a shell script.
    The format of the second line is: /usr/bin/lynx -source "URL" > FILENAME

    For example (note the following is intended to be one line; it might wrap when you view it here):

    /usr/bin/lynx -source "" > /home/virtual/site9/fst/var/www/html/music.html

    The second line runs the lynx program (a linux web browser) and tells it to output the HTML received from the specified URL and the "> FILENAME" causes the output to be saved to the specified file. The URL must be in quotation marks otherwise the "?" will be interpretted as filename wildcard character and cause problems. The FILENAME must be a full path. You can repeat the second line with different URL's/FILENAME's. If your server doesn't have lynx, try replacing "/usr/bin/lynx -source" with "/usr/bin/GET" (no -source parameter).

    2. Web browser initiated updating.

    You can use the following with or without the above cronjob updating. It causes the updating to be done immediately.

    Use a similar shell script as above. You just need to add a few extra commands to it. You might save it in your cgi-bin directory as a file called (upload in ASCII mode and set file execute perissions using CHMOD):

    /usr/bin/lynx -source "URL" > FILENAME
    echo "Content-type: text/html"
    echo ""
    echo ""
    echo "updated"

    As above, you might need to replace "/usr/bin/lynx -source" with "/usr/bin/GET". Repeat the second line with as many URL's/FILENAME's as needed. The FILENAME must be a full path.

    Yours truly,
    Cusimano.Com Corporation
    per: David Cusimano
    Affiliate Tools: Datafeed Merge

  3. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Hello - I'm David
    By RigPa in forum Introduce Yourself
    Replies: 1
    Last Post: February 11th, 2014, 05:02 PM
  2. This is David here
    By davidzou in forum Introduce Yourself
    Replies: 14
    Last Post: March 22nd, 2010, 09:59 PM
  3. David Verus David - American Idol
    By nakedgamer in forum Virtual Family and Off-Topic
    Replies: 32
    Last Post: May 25th, 2008, 01:33 PM
  4. Good Idea - Bad Idea???
    By Packy in forum Commission Junction - CJ
    Replies: 18
    Last Post: August 18th, 2003, 08:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts