new leadership draft being posted...

fedora-devel at tlarson.com fedora-devel at tlarson.com
Thu Dec 4 18:27:08 UTC 2003


Quoting Chris Adams <cmadams at hiwaay.net>:

> Once upon a time, Eric S. Raymond <esr at thyrsus.com> said:
> > Michael K. Johnson <johnsonm at redhat.com>:
> > > I'll get it started.  There are a few pages in sufficient flux that I
> > > might miss adding the $Date$ strings in, but I think that once you see
> > > "This page last modified at:" on the web site, you can be reasonably
> > > sure that pages that don't show that text at the bottom haven't been
> > > recently modified.
> > 
> > There's a easier way.  I use this Javascript fragment in my headers:
> 
> <gag> Javascript! </gag>
> 
> If you want something that is automatic (and doesn't restrict the
> browsers and configurations of visitors to get useful information), you
> can use an Apache server side include:
> 
>     <!--#config timefmt="%A %B %d, %Y" -->
>     This file last modified <!--#echo var="LAST_MODIFIED" -->
> 

For PHP based sites, here's a really cool way to do it. These bits of code 
serve two purposes: they allow you to use PHP to generate pages that can be 
browser-cached just like static .html documents. And as an added bonus, they 
stick the last-modified time at the end of the page.

I don't know what system you use for your site, but these code fragments are 
too wicked cool to just keep to myself.

--- somepage.php ---
<?
$page_FILE = __FILE__;

# set true if you want this page to be cached by the browser. If this page 
# (or the headers) do dynamic content, set to false.
$page_static = true; 

include 'header.inc';
?>
Page content
...
...
<? include 'footer.inc' ?>


--- header.inc ---
<?
if ($page_static && isset($page_FILE)) 
{
   # tell the browser to treat this page like a static .html file
   header("Last-modified: " . date("r", filemtime($page_FILE)))
}
?>
<html><head>..etc.
Header content
...


--- footer.inc ---
<? if (isset($page_FILE)) { ?>
<div id="footer">Last Modified 
<?=date("F j, Y, g: i a T", filemtime($page_FILE))?></div>
<? } ?>
</body></html>

-------





More information about the fedora-devel-list mailing list