On 28 June 2013 14:48, Peter Bowers <[email protected]> wrote:
> On Thu, Jun 27, 2013 at 2:52 PM, Simon <[email protected]> wrote:
> >...
> ...
> [1] Something like this should suffice:
>
> $FmtPV['$MonthNum'] = 'MonthNum($pagename, $name)';
> function MonthNum($pagename, $name)
> {
> $months = array('January'=>'01', 'February'=>'02', 'March'=>'03',
> 'April'=>'04', ...);
> #echo "DEBUG: ".substr($name, 4)."<br />\n";
> if ($mn = @$months[substr($name, 4)])
> return $mn;
> else
> return '00'; // or some suitable error value
> }
>
Pages have the canonical name yyyy-mm-dd or yyyymonth, so I used
$FmtPV['$PageMonthNum'] = 'strftime("%m", strtotime(substr("$name",0,9)))';
// extract month number from page name
$FmtPV['$PageYear'] = 'strftime("%Y", strtotime(substr("$name",0,9)))'; //
extract year from page name
thanks very much
Simon
_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users