[pmwiki-users] Conditional Markup enhancement

Tom Holroyd tomh at kurage.nimh.nih.gov
Wed Mar 2 12:32:27 CST 2005


Here's a very simple example I'm using for a webcam image:

This is in local.php:

# Create markup that returns the time on a file.

Markup('filemtime', 'directives',
         '/\\(:filemtime\\s*(.*?)\\s*:\\)/e', "GetFilemtime(PSS('$1'))");

function GetFilemtime($args)
{
   $arglist = ParseArgs($args);
   return date("D M j H:i:s T Y", filemtime($arglist['file']));
}

Then in the page:

(:filemtime file=/home/path/to/webcam.jpg :)

Displays as

Wed Mar 2 13:30:01 EST 2005

(or whatever the mtime on the file is).
-- 
Dr. Tom Holroyd
"A man of genius makes no mistakes. His errors are volitional and
are the portals of discovery." -- James Joyce



More information about the pmwiki-users mailing list