Re: How to get the html creation date into the "Modified" meta tag?
Wolfgang Schnerring <[email protected]> Fri, 16 Jul 2004 07:31:52 +0200
| Newsgroups | gmane.comp.web.wml |
|---|---|
| Message-ID | <[email protected]> |
* Stephan Petersen <[email protected]>: > when I look at the "Modified" meta tag in my html files, like this one > <meta name="Modified" content="2004-01-16 20:05:27"> > I notice that the date used is the time stamp of the wml file. > > How do I tell wml to use the *creation* date of the html file, i.e. > the time stamp of the html file? Well, as far as I can see, you have to do it yourself: <define-tag mtime whitespace="delete"> <preserve file/> <set-var %attributes /> <: use POSIX qw(strftime); my $file = qq+<get-var file>+; if ($file) { ($mtime) = (stat("$file"))[9]; } else { $mtime = $WML_SRC_TIME; } print strftime("%Y-%m-%d %H:%M:%S", localtime($mtime)); :> <restore file/> </define-tag> This can be called without arguments to display the time for the current file, or called with an argument <mtime file="some-included-file.html"/> Oh by the way: this displays the *modification* time, I'm too lazy to look up the exact Perl stat() syntax (and other WML-variables) to adapt for creation time - I'm not sure why you'd want that anyway... ;-) Hope that helps, Wolfgang _____________________________________________________________________ Website META Language (WML) http://thewml.org User Support Mailing List [email protected] Automated List Manager [email protected]