[pmwiki-users] I want to use FmtPV from mackup to set Page Variable, but can't get it to work reliably

Christopher Cox ccox at endlessnow.com
Fri Jul 14 13:15:59 CDT 2017


Bingo!  Thanks Petko! '<{$var}'


On 07/14/2017 12:59 PM, Petko Yotov wrote:
> When the markup rules are processed one after another, PageVariables 
> like {$mymarkupvar} are replaced with their contents very early. Most 
> other markup rules are processed later, see pmwiki.php?action=ruleset. 
> So your page variable is not yet set when it is encountered in the 
> page, and it is replaced with nothing, empty string.
>
> MarkupMarkup, ie (:markup:) rules are processed before most other 
> rules, and before PageVariables. The content of a (:markup:) block is 
> passed through all markup rules one after another, like for the page, 
> but before the page. At that point, if you encounter your markup rule, 
> it will set the page variable (but not display it in the same block). 
> However, later, when the rest of the page is processed, the page 
> variable value is already set so when your markup is encountered, the 
> variable is replaced with the value.
>
> If you must process your markup rule before {$PageVariables}, change 
> the "when" argument (second) on the Markup() call.
>
> Petko
>
> ---
> Change log     :  http://www.pmwiki.org/wiki/PmWiki/ChangeLog
> Release notes  :  http://www.pmwiki.org/wiki/PmWiki/ReleaseNotes
> If you upgrade :  http://www.pmwiki.org/wiki/PmWiki/Upgrades
>
>
> On 2017-07-14 19:45, Christopher Cox wrote:
>> Ok.. this is weird.  If my (:mymarkup:) is embedded in
>> (:markup:)(:markupend:) it works and my page variable is set. What am
>> I missing?
>>
>>
>> On 07/14/2017 11:45 AM, Christopher Cox wrote:
>>> What I want is to have something like:
>>>
>>>
>>> (:mymarkup:)
>>>
>>> {$mymarkupvar}
>>>
>>>
>>> on a page.  Where mymarkup does inside it's function:
>>>
>>>
>>> global $FmtPV;
>>>
>>>
>>> $GLOBALS['myvar'] = 'hello';
>>>
>>> $FmtPV['$mymarkupvar'] = '$GLOBALS["myvar"]';
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> pmwiki-users mailing list
>>> pmwiki-users at pmichaud.com
>>> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>>>
>>
>>
>> _______________________________________________
>> pmwiki-users mailing list
>> pmwiki-users at pmichaud.com
>> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>




More information about the pmwiki-users mailing list