[pmwiki-users] Testing for an empty page text variable
Randy Brown
alongkiss at aprivatespot.com
Fri May 11 12:25:20 CDT 2012
Thanks, Petko - with your tweak it worked!
Randy
On Tuesday 08 May 2012 21:47:09 Randy Brown wrote:
> I tried writing a custom markup expression to give me the length of MyPTV,
> but the function didn't work:
>
> # for example: {(ptvlen "{$FullName}" "$:MyPTV")}
> $MarkupExpr['ptvlen'] = 'PTVlen($args[0],$args[1])';
> function PTVlen ($page, $ptv) {
> $var=PageTextVar($page,'$:ptv');
> return strlen($var);
> }
Use this unstead:
$MarkupExpr['ptvlen'] = 'PTVlen($args[0],$args[1])';
function PTVlen ($page, $ptv) {
$var=PageTextVar($page,$ptv); # no $: or quotes
return strlen($var);
}
Then, in the page, use this markup expression:
{(ptvlen "{$FullName}" "MyPTV")} # not $:MyPTV
Petko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20120511/5840c281/attachment.html>
More information about the pmwiki-users
mailing list