<div class="gmail_quote">On Fri, Jan 30, 2009 at 12:14 PM, none &lt; <span dir="ltr">&lt;<a href="mailto:bergwitz@gmail.com">bergwitz@gmail.com</a>&gt;</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=&#39;date ..{=$:Timestamp}&#39; $:Timestamp=-:)<br>
<br>
Tried this again today, and it works.<br>
<br>
The reason it didn&#39;t work was that I had PTVs which didn&#39;t follow the<br>
correct pattern. I was using the Norwegian word Tid (Time) as the PTV<br>
and some pages had things like &quot;Tid: Monday the 1st of August&quot; (though<br>
in Norwegian so totally unrecognizable for the pmwiki code). When I<br>
tested it by using Timestamp: &nbsp;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&#39;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&#39;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.&nbsp; This function starts up with a regex to parse the arguments.&nbsp; 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.&nbsp; So if you put your PTV (relatively uncontrolled data) as the FIRST argument and it has something like &quot;February 2, 2009&quot; then DRange() interprets that as &quot;February&quot; as your first argument and &quot;2, 2009&quot; as your last argument.&nbsp; Obviously this gets things really messed up and you get somewhat random results.&nbsp; (Although I&#39;m still not getting anything that brings in all pages -- that&#39;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.&nbsp; Then you also need to check to make sure the PTV is not invalid and that the PTV is not blank.&nbsp; Here&#39;s something that should result in a working system...<br>
<br>(:pagelist name=Test.? if=&quot;expr date {(ftime %Y%m%d)}.. {=$:ts} &amp;&amp; ! date INVALID {=$:ts}&quot; $: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=&quot;date INVALID {=$:ts}&quot; $:ts=-:)<br><br>Hope that solves it for you...<br><br>-Peter<br></div></div>