[pmwiki-users] ZAP revisions update

The Editor editor at fast.st
Sun Jan 7 03:47:30 CST 2007


On 1/6/07, Sivakatirswami <katir at hindu.org> wrote:
> OK you asked for it, you got it:
>
> -- Get create page working ( it was not, two days ago, confirmed by
> several others on zapsite snippet page)

I hadn't noticed it wasn't working again.  It turned out to be one of
the changes I made to how ZAP 2007 handles conditionals.  Upgraded the
markup in the snippet, and it's working fine.  Nothing wrong with the
zapfiles module.

> -- *simple* date entry and manipulation functions (update a date field
> to a new date by + x number of days as well as by setting a specific
> calendar date. the by + x number of days needs to work across
> month end integer boundary:
> adding 10 days to February 24th, 2007 updates data to March 4th, 2007/

Actually both of these are already available.  See the tutorial at
http://www.fast.st/zap/pmwiki.php?n=Help.Markup

To enter current date put {#t +}
To add 10 days, put {#t +|+10d}
To output as a readable string, do {#t +|+10d|%c}

You can also put standard date formats in and get a timestamp out.

{#t 03/15/07}
or even {#t 03/15/07|+2d|%D}, which would output 03/15/07.  etc.

These zap variables (there are several others including #r random
numbers, captcha, and #g group count and thread), because they are
processed after text variables can take page or text variables as
well.  So you can store a page creation date for example with a
zapform (as a timestamp) and then display it in a pagelist or page
like this:

{#t {$:createdate}|%c} or even say {#t {$:createdate}|-2d|%c}

I use this in forums, so I have the option of changing how the time
display looks at any given time for either the forum or the comments.
Much better than static displays.  I also used this extensively in zap
gtd--where it got a great workout.  And I'm am using it currently in a
zapnews application I'm developing that allows you to not only send
large newsletters, but schedule them. Seems to be working great.

Two notes however,

1) Currently, there's no easy way to use a calendar to create a
timestamp in ZAP as I deleted the totime function.  In zapnews you can
put +30d in a field, and hit a schedule button.  It passes that value
as a GET variable back to the page, and updates the form from the
default current timestamp. Then it can be saved properly.  But in
adding back the totime function, it could be done with one form
submission. I've tried to keep zap as lean as possible, but I've run
into several scenarios this would be helpful--always with
workarounds--but still, it's only one line if I recall correctly....

2) I should also note, 2/24 + 10 days would give you 3/6 (3/5 leap
year), not 3/4. I think that's the way I want it.  I thought about
adding +2months or +1year, but it is a bit trickier because of
different year and month lengths.  It could be done, but just haven't
tinkered out the code yet. Probably will at some point... Plus I can't
use +m for months as I'm using it for minutes.  Maybe o? n?

Cheers,
Dan




More information about the pmwiki-users mailing list