Recipe 8.9 Displaying Last Modified Date

Problem

You want your web page to indicate when it was last modified but not have to update the date every time.

Solution

Use SSI processing by putting a line in the HTML file for which you want the information displayed:

<--#config timefmt="%B %e, %Y" --> This document was last modified on <!--#echo var="LAST_MODIFIED" -->

Discussion

The config SSI directive allows you to configure a few settings governing SSI output formats. In this case, we're using it to configure the format in which date/time information is output. The default format for date output is 04-Dec-2037 19:58:15 EST which is not the most user-friendly message. The recipe provided changes this to the slightly more readable format December 4, 2002. If you want another output format, the timefmt attribute can take any argument accepted by the C strftime(3) function.

See Also

  • Recipe 8.8

  • The strftime(3) documentation



Apache Cookbook
Apache Cookbook: Solutions and Examples for Apache Administrators
ISBN: 0596529945
EAN: 2147483647
Year: 2006
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net