MSA - Matt's Script Archive SurveyFactory - Create and publish online web surveys
 Matt's Script Archive: Countdown: Frequently Asked QuestionsView All FAQs @ MSA
 
  Other sites by Matt:
 FormMail.com
  - hosted form processor
 SurveyFactory
  - hosted survey software
 CGI Resource Index
  - 3,000+ Perl Scripts!
 PHP Resource Index
  - 2,000+ PHP Scripts!
 chumpsoft, inc.
  - online survey software


  Matt's Script Archive
    FormMail
    Guestbook
    WWWBoard
    Simple Search
    Counter
    TextCounter
    Random Text
    TextClock
    Free for all Links
    Random Link
    HTTP Cookie Library
    Countdown
      Readme
      Download
      Demo
      > FAQ 
    Random Image
    SSI Random Image
    TextCounter C++
    TextClock C++

Countdown Frequently Asked Questions
    1. Can I add a return link to the Countdown Page?
    2. Can I in-line this into a current Web Page?
1. Can I add a return link to the Countdown Page?
You sure can! Here's how:

Find the subroutine which looks like:

sub html_trailer {
print "<hr>\n";
print "It is currently $current_date\n";
print "</center>\n";
print "</body></html>\n";
}


Now, if you wanted to add a link to Matt's Script Archive, you would edi this to look like:

sub html_trailer {
print "<hr>\n";
print "It is currently $current_date\n";
print "</center><hr>\n";
print "<a href=\"http://www.worldwidemart.com/scripts\">
Matt's Script Archive</a>\n";
print "</body></html>\n";
}


Notice that the quotes (") surrounding the URL have backslashes (\) in front of them. This is because you need to escape these characters when they are inside of a print ""; statement.

Obviously it should be very easy to figure out how to change this to fit whatever URL link you wish to include.
2. Can I in-line this into a current Web Page?
Yep! Only it takes a little more effort than the change shown in the previous question.

First, find the subroutine html_header which looks like:

sub html_header {
print "Content-type: text/html\n\n";
print "<html><head><title>Countdown to: $date_term</title>
</head>\n";
print "<body><center><h1>Countdown to: $date_term</h1>\n";
print "<hr>\n";
}


Now, change this to:

sub html_header {
print "Content-type: text/html\n\n";
}


This gets rid of all of the html, body, head, center, and header tags. Now you will need to do a similar thing to the html_trailer subroutine.

Change it from:

sub html_trailer {
print "<hr>\n";
print "It is currently $current_date\n";
print "</center>\n";
print "</body></html>\n";
}


To contain no statements, like:

sub html_trailer {
}


Now, all that the sript will output is the countdown time However, each time amount (year, month, etc.) will be separated by <br> tags. To change this, find the proper_english subroutine, and change all of the <br> references to ", " (without the quotes).

Now, all that is left is in-lining this into your web page. This requires the use of Server Side Includes. If you can use them, you will probably have to rename your file from filename.html to filename.shtml so the server knows to parse the file. Then include a reference like the following for your countdown to appear:

<!--#exec cgi="/url/path/to/countdown.pl"-->

And it's as easy at that!

 

FormMail.com :: HTML Form to Email Processor
[ Linking to MSA | Advertising Opportunities | Contact Matt ]
© 1995 - 2009 Matt Wright and Matt's Script Archive, Inc.