[pmwiki-users] Checking if a {$$var} is set

Patrick R. Michaud pmichaud at pobox.com
Wed Feb 4 08:46:57 CST 2009


On Tue, Feb 03, 2009 at 08:58:38PM -0500, DaveG wrote:
> Here's what I meant to say.
> Is there a way to determine whether a variable passed into an included 
> page has a value, and whether the variable has actually been passed in? 
> Doing something like:
>    (:include mygroup.mypage var="myval" :)
> 
> and then inside mygroup.mypage:
>    (:if !equal {$$var} "" :)
> 
> The above works, except when {$$var} is not actually passed into the 
> included page, as:
>    (:include mygroup.mypage var="myval" :)
> 
> in which case {$$var} evaluates to the string "{$$var}" (ie, no 
> substitution, as there is nothing to substitute).
> 
> I can use a Markup Expression to do a test, but wondered if there was a 
> 'built-in' way.

There's not currently a 'built-in' way.  I've been musing
that unset variables should probably evaluate to '' instead
of remaining in the markup.

Pm



More information about the pmwiki-users mailing list