[pmwiki-users] Translation problems with form added into $HandleBrowseFmt

Peter Kay pkay42 at gmail.com
Fri Nov 11 09:21:57 CST 2016

On Fri, Nov 11, 2016 at 7:35 AM, Petko Yotov <5ko at 5ko.fr> wrote:
> On 2016-11-11 04:09, Peter Kay wrote:
>> I have a (block level) form I want to add (once) to a page if certain
> Inline markups are processed before block markups so it "should" work.

Sorry - I was writing this late at night, and wasn't clear.  The
problem is that it's block level HTML inside inline HTML, so it's not

Pmwiki is quite happy to do what I ask it to if I put the block level
form there ;)

>> I have added code to slip it into the $HandleBrowseFmt array (right
>> before $PageEndFmt) (similar to the way Live Edit does*).
>> That works quite well, except....translation strings are behaving
>> weirdly.  A specific case in point: $[Editing {*$FullName}] .  I
>> cannot seem to convince pmwiki to properly handle it - instead of
>> "Editing Main.HomePage" I get "Editing {*Main.HomePage}"  It seems
>> $FullName is being resolved before the translation?...
> Do you mean that your adding an entry to $HandleBrowseFmt breaks the
> existing translations in other entries? Or are the broken translations only
> inside the newly added entry?

If I put $[Editing {*$FullName}] in the text that I add to
$HandleBrowseFmt, it does not get translated correctly - anything in
the normal entries looks correct.

> If you add HTML to $HandleBrowseFmt and require translations, you can pass
> the HTML through FmtPageName(). NOT recommended for stuff written by users
> in a page.

I tried FmtPageName.  "Editing {*Main.HomePage}"

XL....well, XL is weird.

global $pagename;
$fpn=FmtPageName('$[Editing {*$FullName}]', $pn);
$xl=XL('$[Editing {*$FullName}]');
SDV($EL['FormText'], "\nTest results: pn: $pn, fpn, $fpn, xl, $xl\n");

If I add the form text to the markup (global $EL; return $EL['FormText'];):

Test results: pn: Main.HomePage, fpn, Editing {*Main.HomePage}, xl,
Editing Main.HomePage

But from the bottom of the page, added via handlebrowsefmt:
    global $EL, $HandleBrowseFmt, $PageStartFmt, $PageRedirectFmt, $PageEndFmt;
    SDV($HandleBrowseFmt,array(&$PageStartFmt, &$PageRedirectFmt, '$PageText',
        &$EL['FormText'],  //slip ourselves in after page text

Test results: pn: Main.HomePage, fpn, Editing {*Main.HomePage}, xl,
Editing {*Main.HomePage}

> If I need to programmatically add some HTML at the bottom of the page body,
> I'd add it as an entry not to $HandleBrowseFmt, but to $HTMLFooterFmt:
>   $HTMLFooterFmt['my-recipe'] = '<form>...</form><script...>';
> If none of these helps, can we see a snippet with the code and markup rules?
> I'd like to try to reproduce it.

I'll go add my form to the HTMLFooterFmt block, and maybe I won't need
to worry anymore, altho the question of why XL is behaving differently
is certainly an intriguing one...

Thanks for the help!!


More information about the pmwiki-users mailing list