[pmwiki-users] Adding/subtracting days to ftime Page Text Variable

Simon nzskiwi at gmail.com
Thu Sep 4 15:26:30 CDT 2014


Possibly
http://www.pmwiki.org/wiki/Cookbook/MoreCustomPageVariables
may help too



On 4 September 2014 21:10, Stef <stefct4 at gmail.com> wrote:

> > On 4 September 2014 17:14, kirpi at kirpi.it <kirpi at kirpi.it> wrote:
> >
> >> > http://www.pmwiki.org/wiki/PmWiki/MarkupExpressions#ftime
> >> > provides the information you need.
> >> > In particular see the information. and importantly the link, about the
> >> > "when" parameter.
> >>
> >> Thank you Simon.
> >> I am not sure I understand what you mean :-)
> >> There is a link pointing to a strange name (strtotime) in a php
> >> website. You mean I should use php instead of javascript, perhaps? Ok,
> >> I will try...
>
> To some of my CopyPasteCalendars I've added "Last Month/Next Month"
> buttons.
> To that end, I've added the following lines of PHP to my config.php:
>
> $MarkupExpr['nextmonth'] = 'nextmonth ($args[0])';
> $MarkupExpr['lastmonth'] = 'lastmonth ($args[0])';
>
> function nextmonth ($argdate)
>         {
>         $arg0 = substr ($argdate,0,4);
>         $arg1 = substr ($argdate,4,2);
>         $arg1 = $arg1 +1;
>         if ($arg1>12)
>                 {
>                 $arg0 = $arg0 + 1;
>                 $arg1 = 1;
>                 }
>         $arg1 = sprintf('%02d', $arg1);
>         return $arg0.$arg1;
>         }
>
> function lastmonth ($argdate)
>         {
>         $arg0 = substr ($argdate,0,4);
>         $arg1 = substr ($argdate,4,2);
>
>         $arg1 = $arg1 -1;
>         if ($arg1<1)
>                 {
>                 $arg0 = $arg0 - 1;
>                 $arg1 = 12;
>                 }
>         $arg1 = sprintf('%02d', $arg1);
>         return $arg0.$arg1;
>         }
>
> PmWiki Markup:
>
> '''[+[[{*$FullName}?ListDate={(lastmonth
> "{$$ListDate}")}?action=browse|«««]] {(ftime fmt="%B %Y" when=(substr
> {$$ListDate} 0 6)01)} [[{*$FullName}?ListDate={(nextmonth
> "{$$ListDate}")}?action=browse|»»»]]+]'''
>
> instead of:
> '''[+{(ftime fmt="%B %Y" when=(substr {$$ListDate} 0 6)01)}+]'''
>
> Maybe you could modify this to suit your needs...
>
> --StefCT
>



-- 
____
http://kiwiwiki.co.nz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20140905/88801c74/attachment.html>


More information about the pmwiki-users mailing list