[pmwiki-users] markup expression XL

SteP step.list+pmwiki at gmail.com
Tue Feb 9 15:12:32 CST 2010


Petko Yotov wrote:

> On Friday 05 February 2010 00:18:09, SteP wrote :
>> I was in a situation where I needed a PTV translated. Using $[ ] did
>> not 
>>  work, i.e., $[ {$:status}]. So I came up with this markup
>>  expression: {(xl status)}
> 
> You could have $[Text] as a value of the PTV:
>   (:status:$[active]:)
> 
> and then use just {$:status}.

Good point. 
I didn't mention that I'm using $:status as an enumeration from php:

$status = PageTextVar($pn,'status');
switch($status){
case 'active':
break;
case 'suspended':
break;
...
}

Still, using (:status:$[active]:) could be done by changing the php code:

if(XL('active')==$status) {
} elseif(XL('suspended')==$status) {
...
}

Either way would work fine. I have a slight preference for the first way, because I find using switch() more 
natural, but it'a a matter of personal taste.  Thanks.




More information about the pmwiki-users mailing list