[pmwiki-users] if exists conditional markup problem

Criss Ittermann crisses at kinhost.org
Thu Apr 2 04:51:48 CDT 2015

Thank you, it spits out:

(:if exists Profile-Data.{Members/Hosts$:201504} :) [...] (:else:) [...] (:if:)

So the PTV does not appear to have been processed yet -- the markup expression has, though.  And this goes for ALL the PTVs throughout the entire IF condition, including the ones I've redacted with [...]

However this violates documentation:

Use page text variables in conditional markup <http://www.pmwiki.org/wiki/PmWiki/ConditionalMarkup>
Page text variables will be assigned/evaluated before any conditional markup is evaluated. This effectively means that you cannot declare a PTV within an if...else condition; and also that a PTV will have a value even if it is set within a (:if false:)....(:if:) condition.

on page
http://www.pmwiki.org/wiki/PmWiki/PageTextVariables <http://www.pmwiki.org/wiki/PmWiki/PageTextVariables>

I upgraded to the latest version and it still doesn't work.  I turned off each recipe and commented out sections of code that even vaguely might affect conditional processing or PTV evaluation one at a time (it's a live site), and no change.  I did not comment out authentication, captcha or PmForm, since these would break the site in a very bad way and are released by PM & Petko.

Just for giggles, to take the complexity out of the if-conditional, I even tried:

TempVar:Profile-Data.{Members/Hosts$:{(ftime "%Y%m")}}

(:if exists {$:TempVar} :)

But of course, that failed too.  But the variable itself is set correctly.

This fails too, whether I use the full expression, or the new variable:

(:if equal "{$:TempVar}" "Profile-Data.HEdelman" :)  
revealing the if conditional before it processes:
(:if equal "Profile-Data.{Members/Hosts$:201504}" "Profile-Data.HEdelman" :)

(:if false:)
TempVar:Profile-Data.{Members/Hosts$:{(ftime "%Y%m")}}

Still sets the variable.

> On Apr 1, 2015, at 8:25 PM, John Rankin <john.rankin at affinity.co.nz <mailto:john.rankin at affinity.co.nz>> wrote:
> It may be possible to intercept the if code and find out what condition pmwiki is evaluating, which should give information about what is happening. Try this in local/config.php:
> $CondTextReplacement = "MyTempRepl(\$pagename, \$m[0], \$m[1])";
> function MyTempRepl($pagename, $text, $code='') {
>   echo $text;
>   return CondText2($pagename, $text, $code);
> }
> If I am reading stdmarkup.php correctly, this should echo the contents of the if code at the time the conditional is evaluated, which will show whether the var has been evaluated as intended.
> JR
> On 2/04/15 12:07 AM, Criss Ittermann wrote:
>> I'm trying to figure out why this is returning false ("To be announced."):
>> (:if exists Profile-Data.{Members/Hosts$:{(ftime "%Y%m")}} :)
>> ...
>> (:else:)
>> To be announced.
>> (:ifend:)
>> When the following returns a fully functioning link to the correct page, which exists:
>> [[Profile-Data.{Members/Hosts$:{(ftime "%Y%m")}}]]
>> What am I doing wrong?
>> Crisses
>> _______________________________________________
>> pmwiki-users mailing list
>> pmwiki-users at pmichaud.com <mailto:pmwiki-users at pmichaud.com>
>> http://www.pmichaud.com/mailman/listinfo/pmwiki-users <http://www.pmichaud.com/mailman/listinfo/pmwiki-users>
> -- 
> John Rankin
> Affinity Limited
> T +64 4 495 3737
> M +64 21 726 546
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com <mailto:pmwiki-users at pmichaud.com>
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20150402/a38e33d1/attachment.html>

More information about the pmwiki-users mailing list