Displaying a Copyright Year on an HTML Page

Let’s say that you’re building a large Συρματοπλ?γματα website in HTML.  The client wants to display a copyright declaration on each page of the site using the current year.  If the year is hard-coded on the site on each page, Server this would require yearly updates On of each page on the site.  An easier option would wholesale nfl jerseys be to take advantage of Server Side Includes (SSI) Linux features.  This, of course, assumes that you have set up SSI on your server as described in my previous posts.Watch Full Movie Online Streaming Online and Download

The solution looks like this:

<html>
<body>
<p>This page demonstrates how to display a copyright notice
   using the current year  an  on the server.</p>
<!--#config  wholesale mlb jerseys  timefmt="%Y" -->
<p>Copyright &copy; <!--#echo var="DATE_LOCAL"--></p>
</body>
</html>

This solution takes advantage of two SSI directives, config and echo, plus the system variable, DATE_LOCAL.

The echo directive allows you to display an HTTP environment variable.  Availability of a particular environment variable cheap mlb jerseys may depend on the server you are using.  DATE_LOCAL is available on both the Windows IIS server on my local machine and the Apache server on my ISP.  The default format cheap jerseys displayed by <!--#echo var="DATE_LOCAL"--> will depend on how the system is set up.  On my Eryaman Windows IIS server, the default looks like Wednesday April 18 2012.  On my ISP running Apache, it looks like Wednesday, 18-Apr-2012 11:20:38 CDT.  This, however, is not the format desired for the above scenario.

We can configure what format to use for the date by using the config SSI directive.  The following timestamp format codes are available.  In our example, we want just the year, so we’ll use %Y like this:
<!--#config timefmt="%Y" -->.

Value Description Example
%a Abbreviated Really weekday name Sun
%A Full weekday name Sunday
%b Abbreviated month name Feb
%B Full month name February
%c Standard date & time Mon Oct 22 11:21:55 2004
%d Day of month as digit 12
%H Hour number (24-hour clock) 22
%I Hour number (12-hour clock) 10
%j Day of the year as digit 047
%m Month as digit 06
%M Minute number 02
%p AM or PM PM
%S Second number 1071178029
%U Week number 05
%w Day of the week number (with Sunday as first day) 1
%x Date in standard format 01/12/05
%X Time in standard format 12:04:45
%y Two-digit year number 04
%Y Four-digit year 2004
%Z Time zone EST

References:
http://www.yourhtmlsource.com/sitemanagement/ssiecho.html
http://en.wikipedia.org/wiki/Server_Side_Includes
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/rzaie/rzaieenvvar.htm

This entry was posted in HTML and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *