<div class="gmail_quote">On Fri, Jan 30, 2009 at 12:14 PM, none < <span dir="ltr"><<a href="mailto:bergwitz@gmail.com">bergwitz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Audun Myhra Bergwitz wrote:<br>
<br>
</div>(:pagelist if='date ..{=$:Timestamp}' $:Timestamp=-:)<br>
<br>
Tried this again today, and it works.<br>
<br>
The reason it didn't work was that I had PTVs which didn't follow the<br>
correct pattern. I was using the Norwegian word Tid (Time) as the PTV<br>
and some pages had things like "Tid: Monday the 1st of August" (though<br>
in Norwegian so totally unrecognizable for the pmwiki code). When I<br>
tested it by using Timestamp: as the PTV (which only appear on my test<br>
pages) and all PTVs followed recongizable pattern the code work as expected.<br>
<br>
Due to the unrecognizable format of some PTVs the pagelist code seem to<br>
ignore the whole If-thing. I don't know it this is a bug in the code, or<br>
if it is the intended behaviour.<br>
<br>
Anyway it makes my idea of making an event calendar based on<br>
PTV-Timestamps somewhat vulnerable, as just one wrongly formatted PTV<br>
will cause all pagelists based on the PTV-timestamp to list everything.<br>
Though, I think I can work around that.<br>
</blockquote><div><br>I think I've figured out some things that will at least move us forward in understanding as well as (I think) giving a working solution...<br><br>The date condition calls DRange() in pmwiki. This function starts up with a regex to parse the arguments. The regex does NOT allow spaces (\S*) in the first 2 arguments (i.e., before and after the ..) but DOES allow spaces (\S.*) in the last argument. So if you put your PTV (relatively uncontrolled data) as the FIRST argument and it has something like "February 2, 2009" then DRange() interprets that as "February" as your first argument and "2, 2009" as your last argument. Obviously this gets things really messed up and you get somewhat random results. (Although I'm still not getting anything that brings in all pages -- that's a puzzler.)<br>
<br>In order to get around this problem (note that only English dates will be recognized by strtodate()) you need to put your PTV as the last argument. Then you also need to check to make sure the PTV is not invalid and that the PTV is not blank. Here's something that should result in a working system...<br>
<br>(:pagelist name=Test.? if="expr date {(ftime %Y%m%d)}.. {=$:ts} && ! date INVALID {=$:ts}" $:ts=-:)<br><br>It may also be helpful to periodically run something that would check for those invalid dates since presumably those pages with a PTV set to an unrecognized date are intended to be displayed and so you would want to correct them:<br>
<br>(:pagelist name=Test.? if="date INVALID {=$:ts}" $:ts=-:)<br><br>Hope that solves it for you...<br><br>-Peter<br></div></div>