[pmwiki-users] Set PTV to value of an expression

Lars Eighner surname at larseighner.com
Thu Jul 25 23:31:50 CDT 2013


I think this question is posed on

<http://www.pmwiki.org/wiki/PmWiki/PageTextVariables-Talk>

but if it is, I cannot understand the answer.



On a page named LaurenceVailEighnerGGGrandParents
I have

(:Subject:{(substr "{$Name}" 0 -14  )}:)

(:Subj2:{{$:Subject}$:Father} :)

The PTV Subject is calculated from $Name, and it looks right.

I want PTV Subj2 to be equal to the PTV Father on another page.  This seems
to work when I echo Subj2, but when I try to use Subj2 in another expression
it appears that the assignment of Subj2 did not set Subj2 to the value of 
the expression  {{$:Subject}$:Father}, but set it to the expression itself,
so it seems to echo okay by re-evaluating the expression, but fails when I
use it in other expressions it fails because it is equal to the expression
string and not the string that is the value of the expression.


So:

{$:Subject}

(:if exists {$:Subject}:)HooHah(:else:)BooYah(:ifend:)

{$:Subj2}

{(pagename {$:Subj2} )}

(:if exists (pagename {$:Subj2}) :)HooHah(:else:)BooYah(:ifend:)


When rendered:


LaurenceVailEighner

HooHah

Lawrence Clifton Eighner

(pagename {Lawrence Clifton Eighner )}

BooYah

(Which is the wrong answer since the page LawrenceCliftonEighner does
exist.)


I've been quoting, unquoting, square, curly, and round bracketing and
debracketing stuff when the PTV is set and when it used for days without
making any progress.


I want to set a PTV to the value of an expression which is evaluated once
when the PTV is set and is never evaluated again so that the PTV has the
value of the result string, not the expression string.



-- 
Lars Eighner
http://www.larseighner.com/index.html
8800 N IH35 APT 1191 AUSTIN TX 78753-5266




More information about the pmwiki-users mailing list