Electric Type

Multimedia

About Us

News

Help

Time for Server-Side Includes
by Sven Heinicke 19 Sep 1996

Sven Heinicke spends his days abusing GNU/Linux systems at the NEC Research Institute in Princeton, New Jersey. He lives in a barn and maintains a small herb and vegetable garden.

Page 1

Q:  I would like to be able to put the current time and date on my homepage. Is there a CGI script (or something else) that will "grab" this info and display it on my page whenever someo ne loads it?
- Dante

A:  Since you indicated CGI as a possible solution, I'll assume you'd like to display the time that's recorded on the server. (To display the time that's on a local machine, you could use Java or JavaScript, but I won't get into that this time.) If your server supports NCSA HTTPd-style server-side includes, you can do this easily without any messy CGI scripts. Just make sure your webmaster has SSI turned on, and put a line like this i n your document:

    <!--#echo var="DATE_LOCAL"-->

Which should produce:

    Wednesday, 29-Oct-97 19:37:44 PST

The characters <!-- and --> surround HTML comments, which aren't actually displayed on the page. Before an HTTP server sends out a page, it scans it for comments that begin with a pound sign (#). When it finds one, it checks the command after the # (in this case, echo) and executes an action depending on the arguments that follow it (var="DATE_LOCAL"). If you need more information on format standards, the NCSA has a full description.

next page»


Dynamic HTML  

Frames  

HTML Basics  

Stylesheets  

Tables  

XML  

Javascript  

Database Connections  

Intro To Perl  

HTML 4.0  

User Blogs

Screen Shots

Latest Updates

Contact Us

Valid HTML 4.01!
Valid CSS!

Breadcrumb

© ElectricType
Maintained by My-Hosts.com
Site map | Copyright | Disclaimer
Privacy policy | Acceptable Use Policy
Legal information.