<div dir="ltr"><div><div>I am putting together a web-site where the help is served in a jsquery-ui dialog populated by AJAX.  Up until now I've coded the help in HTML and just put it directly in PHP variables.  As the site matures the documentation is growing rapidly and maintaining it in HTML is getting a bit onerous -- it would be great if I could maintain the docs in pmwiki.<br>


</div><div><br>In order to serve just the page text I've created an action handler.  I could totally replace HandleBrowse() if necessary, but it feels like I should be able to just set a couple configuration variables and re-use that functionality.<br>


<br>When I do this:<br><br></div><div>===(snip)===<br>function HandleAJAXPageText($pagename, $auth = 'read')<br>{<br>    global $HandleBrowseFmt;<br>    $HandleBrowseFmt = array('function:PrintJSON($PageText)');<br>


    HandleBrowse($pagename, $auth);<br>}<br><br>function PrintJSON($pagename, $out)<br>{<br>    header("Content-type: application/json");<br>    print json_encode($out);<br>}<br>===(snip)===<br><br></div><div>The $PageText ends up getting replaced by the contents of the web-page and then the 'function:PrintJSON(hello this is the text on the page)' no longer matches the regex for a valid function and the function is never called.  I end up getting a web-page that includes the PrintJSON( ... ) function call as part of the text on the page served.<br>

<br></div><div>(The relevant part of pmwiki code is in pmwiki.php around line 1182 - in the PrintFmt() function.)<br></div><div><br></div><div>I tried various ways of getting the 'function:PrintJSON(...)' to pass the variable $PageText rather than the contents of it, but I'm not making any progress...<br>

<br>Any ideas?<br>
</div><div><br></div></div>-Peter<br></div>