[pmwiki-users] Markup for Page Text Variables

Dave Cooke david at ellendee.co.uk
Thu Apr 24 09:04:15 CDT 2008

Peter & Melodye Bowers <pbowers <at> pobox.com> writes:

> > Is it possible to either alter markup or create new markup 
> > for PTV's. It would
> > suit my purposes if I could define a PTV thus:
> > PTV (Value)
> > {$:PTV} would then display Value?
> There is currently a definition of $PageTextVarPatterns like this in
> pmwiki.php:
> ===(snip)===
> $PageTextVarPatterns = array(
>   'var:'        => '/^(:*\\s*(\\w[-\\w]*)\\s*:[ \\t]?)(.*)($)/m',
>   '(:var:...:)' => '/(\\(: *(\\w[-\\w]*) *:(?!\\))\\s?)(.*?)(:\\))/s'
>   );
> ===(snip)===
> I believe you could just put this line in your config.php and it would work:
> $PageTextVarPatterns['var()'] = '/^((\\w[-\\w]*)\\s+\\()([^)]*)(\\))/m';
> I assume you've already thought through the ramifications in terms of not
> being able to have a close-parenthesis in the value of the variable, etc...
> This will allow multi-line values in PTVs as well.
> -Peter

Thanks. This does just what I wanted. I only need this facility in one group so
I'm going to place it in the local configuration for that group. I'm homeless at
working out these text patterns. I must dive in and have a go. But as for now
many thanks.

Dave C

More information about the pmwiki-users mailing list