Re: [pmwiki-users] Problem using MarkupExpressions with ZAP variable
Thanks for your guidance. Indeed, it is much more interesting to store dates with a format easy to read! Yet, I still have some difficulties. Here is the value of the variable ActionDeadline: (:ActionDeadline: 20080230T1600+0100:) If I try to display this date with the ftime markup: * Date: {(ftime %D {$:ActionDeadline})} I get: * Date: 01/01/70 What is the problem? 2007/6/17, Patrick R. Michaud <[EMAIL PROTECTED]>: On Sun, Jun 17, 2007 at 03:08:51PM -0400, The Editor wrote: > On 6/17/07, Patrick R. Michaud <[EMAIL PROTECTED]> wrote: > >On Sun, Jun 17, 2007 at 08:55:55AM -0400, The Editor wrote: > >> > >> I still don't like all the changes Pm made to the time function, > >> specifically to require the @ symbol, but that's how it works in > >> PmWiki. > > > >I felt this was important so that we could reliably distinguish > >ISO dates (20070617) from UNIX timestamps (@20070617). > > Perhaps the problem has > to do with the lack of documentation. Not sure where to put it though > as it's not really a ZAP function any longer. Since ZAP is providing the interface to strtotime(), I think that's probably a good place to mention the use of @ when using the results of strtotime with {(ftime)}. PmWiki itself doesn't expose timestamps to authors, but instead tries to stick with ISO formats (which have the advantage of being readable and meaningful to most authors). And, of course, {(ftime)} will accept any format that strtotime() accepts, so instead of calling strtotime in the zap form and storing the result, one could instead just store the human-readable value directly, and avoid the conversion to a timestamp altogether. Thus, instead of: > (:zapform key=AddEvent:) > (:input text EventYear:) > (:zap php_EventDate="strtotime|{EventYear}" AddEvent:) > (:zap EventDate="{php_EventDate}" AddEvent:) > (:zap savedata="EventDate" AddEvent:) > (:input submit:) > (:zapend:) > > {(ftime %Y when="{$:EventDate}":) I would think that one could more easily do something like: (:zapform key=AddEvent:) (:input text EventYear:) (:zap EventDate="{EventYear}" AddEvent:) (:zap savedata="EventDate" AddEvent:) (:input submit:) (:zapend:) {(ftime %Y when="{$:EventDate}":) In fact, it seems that one could just save EventYear directly to the page, and use it directly: {(ftime %Y when="{$:EventYear}":) Pm ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Problem using MarkupExpressions with ZAP variable
On Sun, Jun 17, 2007 at 03:08:51PM -0400, The Editor wrote: > On 6/17/07, Patrick R. Michaud <[EMAIL PROTECTED]> wrote: > >On Sun, Jun 17, 2007 at 08:55:55AM -0400, The Editor wrote: > >> > >> I still don't like all the changes Pm made to the time function, > >> specifically to require the @ symbol, but that's how it works in > >> PmWiki. > > > >I felt this was important so that we could reliably distinguish > >ISO dates (20070617) from UNIX timestamps (@20070617). > > Perhaps the problem has > to do with the lack of documentation. Not sure where to put it though > as it's not really a ZAP function any longer. Since ZAP is providing the interface to strtotime(), I think that's probably a good place to mention the use of @ when using the results of strtotime with {(ftime)}. PmWiki itself doesn't expose timestamps to authors, but instead tries to stick with ISO formats (which have the advantage of being readable and meaningful to most authors). And, of course, {(ftime)} will accept any format that strtotime() accepts, so instead of calling strtotime in the zap form and storing the result, one could instead just store the human-readable value directly, and avoid the conversion to a timestamp altogether. Thus, instead of: > (:zapform key=AddEvent:) > (:input text EventYear:) > (:zap php_EventDate="strtotime|{EventYear}" AddEvent:) > (:zap EventDate="{php_EventDate}" AddEvent:) > (:zap savedata="EventDate" AddEvent:) > (:input submit:) > (:zapend:) > > {(ftime %Y when="{$:EventDate}":) I would think that one could more easily do something like: (:zapform key=AddEvent:) (:input text EventYear:) (:zap EventDate="{EventYear}" AddEvent:) (:zap savedata="EventDate" AddEvent:) (:input submit:) (:zapend:) {(ftime %Y when="{$:EventDate}":) In fact, it seems that one could just save EventYear directly to the page, and use it directly: {(ftime %Y when="{$:EventYear}":) Pm ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Problem using MarkupExpressions with ZAP variable
On 6/17/07, Patrick R. Michaud <[EMAIL PROTECTED]> wrote: > On Sun, Jun 17, 2007 at 08:55:55AM -0400, The Editor wrote: > > > > I still don't like all the changes Pm made to the time function, > > specifically to require the @ symbol, but that's how it works in > > PmWiki. > > I felt this was important so that we could reliably distinguish > ISO dates (20070617) from UNIX timestamps (@20070617). And I didn't > invent the @-notation out of thin air -- it's the way that several > GNU utilities represent timestamps [1] (as documented from the PHP > strtotime() function [2], which ZAP itself is using). > > So yes, that's how it works in PmWiki. :-) Sorry Pm, didn't mean to imply I didn't agree with your choice, just that I didn't like it. :) I should have shared your reasons for you for you and saved you the trouble of having to retype them. Still, I know it did cause me headaches, and several others have had trouble with time functions since then also. Perhaps the problem has to do with the lack of documentation. Not sure where to put it though as it's not really a ZAP function any longer. Cheers Dan ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Problem using MarkupExpressions with ZAP variable
On Sun, Jun 17, 2007 at 08:55:55AM -0400, The Editor wrote: > > I still don't like all the changes Pm made to the time function, > specifically to require the @ symbol, but that's how it works in > PmWiki. I felt this was important so that we could reliably distinguish ISO dates (20070617) from UNIX timestamps (@20070617). And I didn't invent the @-notation out of thin air -- it's the way that several GNU utilities represent timestamps [1] (as documented from the PHP strtotime() function [2], which ZAP itself is using). So yes, that's how it works in PmWiki. :-) [1] http://www.gnu.org/software/tar/manual/html_node/tar_109.html [2] http://www.php.net/strtotime Pm P.S.: I'll grant that it's fairly unlikely that PmWiki users will be using timestamps like "20070617", which refer to times in the latter part of 1970. But I still think it's better to have something that clearly marks a sequence of digits as being a timestamp. ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Problem using MarkupExpressions with ZAP variable
On 6/16/07, Benoit Dutilleul <[EMAIL PROTECTED]> wrote: > Hello, > > I'm still working on this system to manage events and struggling with the > conversion of date and time into a timestamp. Now, I have a basic ZAP script > working but it seems that the ftime markup does not work with ZAP variables. > > (:zapform key=AddEvent:) > (:input text EventYear:) > (:zap php_EventDate="strtotime|{EventYear}" AddEvent:) > (:zap EventDate="{php_EventDate}" AddEvent:) > (:zap savedata="EventDate" AddEvent:) > (:input submit:) > (:zapend:) > > {$:EventDate} > > {(ftime %Y when="{$:EventDate}")} > > Can somebody help? > Kind regards, > > Benoit I still don't like all the changes Pm made to the time function, specifically to require the @ symbol, but that's how it works in PmWiki. I tested this on my system and it worked fine: {(ftime %Y when="@{$:time}")} (:time: 1234567890:) Note: this is not really a ZAP variable. It's a standard PmWiki PTV. ZAP may be have been used to save it, but it could have been saved by any of several mechanisms, and once saved it is handled entirely by PmWiki. Just a thought to keep in mind. Cheers, Dan ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
[pmwiki-users] Problem using MarkupExpressions with ZAP variable
Hello, I'm still working on this system to manage events and struggling with the conversion of date and time into a timestamp. Now, I have a basic ZAP script working but it seems that the ftime markup does not work with ZAP variables. (:zapform key=AddEvent:) (:input text EventYear:) (:zap php_EventDate="strtotime|{EventYear}" AddEvent:) (:zap EventDate="{php_EventDate}" AddEvent:) (:zap savedata="EventDate" AddEvent:) (:input submit:) (:zapend:) {$:EventDate} {(ftime %Y when="{$:EventDate}")} Can somebody help? Kind regards, Benoit ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users