Server Side Includes
Server Side Includes allow you to create dynamic HTML documents. Commands embedded in the HTML force the server to perform a calculation, insert a variable (like the date or time), a file or document, or execute a CGI program. Since the web page is not "fixed" until "run-time," the page is said to be created "on-the-fly."
Here are a few simple Server Side Includes you can include in your HTML to add function to your web pages. (Note - the following Server Side Includes are standard NCSA commands, you may need to alter the syntax if you are not serving from a Httpd server, you may need to alter the syntax. Some server configurations require documents featuring Server Side Includes to end with the extension ".shtml". You may also need to have your server administrator enable Server Side Includes for your website.
Last Updated...
Insert the following line to show the last date a document was updated. You should alter the name of the file to reflect the name of the page.
<small><i>Last updated <!--#config timefmt="%B %d, %Y" --><!--#flastmod file="index.html" --></i></small>
You can also insert the present date and time (useful for scripts generating orderforms) by inserting the following line:
<!--#echo var="DATE_LOCAL" -->
Prepending this statement with a variation of the following will vary the output as listed:
<!--#config timefmt="%c" --><!--#echo var="DATE_LOCAL" -->
Here are a few of the format time codes:
- %a -- abbreviated weekday name
- %A -- full weekday name
- %b -- abbreviated month name
- %B -- full month name
- %m -- month number
- %c -- date and time
- %d -- day of the month
- %x -- date (without time)
- %X -- time (without date)
- %y -- last two digits of year
- %Y -- 4 digit year
- %H -- hour (24 hour clock)
- %I -- hour (12 hour clock)
- %M -- minute
- %S -- second
- %p -- a.m./p.m.
- %Z -- time zone
As indicated in the first example, you can mix these and insert punctuation as needed.