[WM] Modification Time

Justin Mason jm.jmason.org
Mon May 28 14:36:51 IST 2001


Markus Deiml said:

> since a few months I use webmake to manage my small website. Webmake is
> quite perfect for me, many thanks to all developers (especially J. Mason,
> of course).

Cheers!

> I have just a small problem. I wonder if webmake can help me to write a
> modification time in the buttom of my webpages, for example something like
> "Last modified: May 26th 2001". But unlike WebMake.Time which gives me the
> date/time of the last invocation of webmake I rather would like to have for
> each page the mtime of the corresponding source file (which im my case are
> text files going through ettext).
> 
> Perhaps this is easy to achieve, but unfortunately I'm not a perl
> programmer at all.

This should work:

      <content name="lastmod">
	<{perl

	  my $name = get_current_main_content();
	  my $time = get_content ("$name.mtime");

	  use POSIX qw(strftime);
	  use locale;
	  strftime (""%a %b %e %H:%M:%S %Y", localtime ($time));

	}>
      </content>

Then you can insert references to $[lastmod] in your page templates, and
it will be replaced with the modification date of the main content item on
that page.

Hope that helps!   (I really must add this as a 'standard' variable btw)

--j.




More information about the Webmake-talk mailing list