2009/8/11 Graham Archer <[email protected]>:
Regarding PTV's and conditional markup.....
I read at PmWiki/PageTextVariables-Talk that it's possible to do:
LinkUrl: (:if name{$FullName}:)http://dilbert.com(:else:)[[Cookbook:Quotes]](:ifend:)
{$:LinkUrl}
I'm the one who added that to the page, so probably ought to take some
responsibility here...
Thinking about this a bit more, the answer's perhaps a bit trickier
than I first thought. What's happening with the above is that the
value of LinkUrl will be set to all of '(:if
name{$FullName}:)http://dilbert.com(:else:)[[Cookbook:Quotes]](:ifend:)',
ie. the value of the conditional _expression_ isn't evaluated until it's
used on a page, in which case it'll get evaluated for each time it's
used.
Provided that you've got $EnableRelativePageVars set to true this
should be fine, even when used from another page -- except for
conditionals such as (:if name:) and (:if group:), which will get
evaluated in the context of the including page irrelevant of
$EnableRelativePageVars.
or in my case I can do:
APACStatus:(:if equal "{$:ApprovalStatusAPAC}" "Approved"
:)Attach:tick.png(:ifend:)
{$:APACStatus}
However in doing this the PTV ( APACStatus) in the first line is shown to
the reader, I'd like that hidden
Hmmm. Apologies for the slight mindfuck, but the following should work
(see example near the end of <http://www.pmwiki.org/wiki/Test/Ptv> if
this gets mangled):
(:if2 false:)
APACStatus:(:if equal "{$:ApprovalStatusAPAC}"
"Approved":)Attach:tick.png(:ifend:)
(:if2end:)
or alternatively:
comment<<
APACStatus:(:if equal "{$:ApprovalStatusAPAC}"
"Approved":)Attach:tick.png(:ifend:)
<<
Therefore I would like to do something like ....
(:APACStatus:(:if equal "{$:ApprovalStatusAPAC}" "Approved"
:)Attach:tick.png(:ifend:):)
{$:APACStatus}
But it seems either I'm using the wrong syntax, or perhaps this is not
possible, or at least not possible in the way I am trying!!
Would appreciate any advice on this.
What you tried didn't work since you can't easily nest (:directives:)
-- they're always terminated by the first matching :) which will break
stuff if the outer directive gets evaluated first. Especially as page
text variables are read from the markup outside the normal order of
markup -> HTML transformations.
eemeli
Thank you
Graham
_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users