Wiki source for LatestAction


Show raw source

=====Latest Action=====

>>==See also:==
~-Documentation: LatestActionInfo
>>This is the development page for the latest changes action.::c::

The php code of actions/latest.php:

%%(php)
<?php
/**
* Add list of n latest changes, like a portable RecentChanges.
*
* Usage: {{latest max="5"}}
*
* @package Latest
* @subpackage
* @name latest
*
* @author {@link http://www.guegue.com/~javier/ Javier Wilson} - original idea and code.
* @version 0.1
* @since Not (yet?) part of offical Wikka release
*
* @input int $max optional: number of listings
*
* @todo Nothing I can think about for now.
*
*/

if(!defined('REVISION_DATE_FORMAT')) define('REVISION_DATE_FORMAT', 'd M Y');

// set defaults
$max = 5;
$output ='';

// ***** PARAMETERS Interface *****
$uMax = $vars['max'];
if ($uMax) $max = $uMax;
// ***** end PARAMETERS Interface *****

// ***** HTML code generation *****
$j = 0;
if ($pages = $this->LoadRecentlyChanged()) {
foreach ($pages as $i => $page) {
if ($this->HasAccess('read', $page['tag'])) {
list($day, $time) = explode(' ', $page['time']);
$dateformatted = date(REVISION_DATE_FORMAT, strtotime($day));
$output .= ' '.$this->Link($page['tag'], '', '', 0).'<span class="datetime"> '.$dateformatted.'</span><br />'."\n";
$j++;
if ($j > $max)
break;
}
}
}
// ***** end HTML code generation *****
print $output;
?>
%%

----
CategoryUserContributions.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki