View Full Version : Preserving html in returned string
danloatmba
03-13-2009, 01:58 AM
I'm off an racing with my fist extension (php/XMLRPC) - returning some results form a MSSQL database query. The query works fine but I am loosing any html returned in the string.
How do I make DekiWiki honour the html in the returned string?
The normal php string functions don't appear to be much help.
Thanks,
DANIEL...
danloatmba
03-13-2009, 04:36 AM
My php looks like
============================ =============================
<?php
//error_reporting(E_ALL);
include('DekiExt.php');
DekiExt(
//extension title
"Mindtouch Deki Extension Php Service",
null,
//returns "db query results" as a string
array(
"searchDB():str" => "doTheSearch"
)
);
function doTheSearch() {
$myServer = "serverHost.blah.blah";
$myUser = "pdsql";
$myPass = "passwordhere";
$myDB = "docs";
$sql = "select pro.docnumber, pro.docname, p.full_name as 'author', q.full_name as 'typist', r.full_name as 'last edited by', pro.last_edit_date from docsadm.profile pro join docsadm.people p on pro.author = p.system_id join docsadm.people q on pro.typist = q.system_id join docsadm.people r on pro.last_edited_by = r.system_id where pd_file_part = (select system_id from docsadm.pd_file_part where pd_filept_no like 'F-003696/(P01)')";
//connection to the database
$conn = sybase_connect ("serverHost.blah.blah","pdsql","passwordhere");
$d = sybase_select_db("docs", $conn)
or die("Couldn't open database Docs");
$result = sybase_query ($sql);
$numrows = sybase_num_rows($result);
//display the results
$myOutput = $numrows . 'matches found:';
while($row = mssql_fetch_array($result)) {
$myOutput .= '>>' . $row["docnumber"] . $row["docname"] . '<br/>';
}
//return results ;
return $myOutput ;
//close the connection
mssql_close(conn);
}
?>
My wiki entry is:
============================ =============================
{{ searchDB() }}
============================ =============================
And I'm getting:
============================ =============================
59matches found:>>3276115Working Groups - JDE Rollout<br/>>>3301727TEMPLATE- AGENDA<br/>>>3301806ASSETS - MINUTES - 17 December 08<br/>>>3301809ASSETS - Agenda - 16 Jan 09<br/>>>3301811COSTING - Minutes - 17 Dec 08<br/>>>3301813GENERAL ACCOUNTING - Minutes - 14 Jan 09<br/>>>3301814GENERAL ACCOUNTING - Minutes - 17 December 08<br/>>>3301815AP PURCHASING STORES - Minutes - 17 Dec 08<br/>>>3301816PAYROLL - Minutes - 17 Dec 08<br/>>>3301821PSG - Minutes - 23 Sept 08<br/>>>3301823PSG - Minutes - 10 Nov 08<br/>
etc...
============================ =============================
The page source of which looks like
============================ =============================
<p>59matches found:>>3276115Working Groups - JDE Rollout<br/>>>3301727TEMPLATE- AGENDA<br/>>>330180
etc...
============================ =============================
Obviously I would like to format the output so that the html tags are honoured.
Do I have to use some base64 encoding or is there another option other than the ":str" to pass this back to DekiWiki with?
I note the IXR_Library.inc.php has a 'base64' should I play with this?
Thanks in advance,
DANIEL...
SteveB
03-16-2009, 04:32 PM
You have to mark your return type as being 'xml' and then build a DekiScript XML (http://wiki.developer.mindtouch.com/DekiScript/Reference/DekiScript_Remote_Function_Calls) string by hand. The HTML you wish to preserve must be returned as an embedded HTML document.
For example, to return "hello world" in bold, you need to do return something that looks like this:
<html>
<body><strong>Hello World</strong></body>
</html>
Powered by vBulletin™ Version 4.1.3 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.