I'm utilizing a publish template from inside Wordpress to produce a table. Nevertheless the formatting is a little screwed up.

The PHP that creates the code gets into and queries a server for that user's test information during the day. After that it trims lower that internal are accountable to get only the table. Observe that the report doesn't close the tag, and so i needed to make use of a str_replace to shut that tag.

global $current_user;

get_currentuserinfo();

$raw_contents = file_get_contents('http://******/NamedRptRun.asp?Rpt=DailyUserSum&Prj=******_****UserId='.($current_user->user_login));

    $trim_raw = trim($raw_contents);
//echo htmlentities($trim_raw);

if ($trim_raw == 'No Records Returned')  {

    echo 'No test cases to report today.';

} else {

    $tag = '<TABLE';

    $topTrim_contents = stristr($raw_contents, $tag);

    $tag = '</BODY>';

    $table_only = stristr($topTrim_contents, $tag, TRUE);

    $table_only = str_replace("</tr></table>", "</tbody></tr></table>",$table_only);

   echo htmlentities($table_only);
   echo str_replace(array("\r\n","\n","\t"), ' ',$table_only);

}

This generates for me both code for that table (just for debugging reasons), in addition to what ought to be the table. However, the values on the table aren't really inside the table, but they are proven at risk over the table.

<TABLE cellspacing=0 cellpadding=0 border=1 bordercolor=Silver>
<thead class=b>
<TR bgColor=WHITE>
<th>&nbsp;Engineer&nbsp;</th><th>&nbsp;Passed&nbsp;</th><th>&nbsp;PWWarn&nbsp;</th><th>&nbsp;Blocked&nbsp;</th><th>&nbsp;Failed&nbsp;</th><th>&nbsp;Total Run&nbsp;</th></tr></thead><tbody class=h><TR bgColor=#F1F1F1><TD nowrap>myname</td><TD nowrap>1</td><TD nowrap>0</td><TD nowrap>0</td><TD >0</td><TD nowrap>1</td></tbody></tr></table>

10001
 Engineer    Passed      PWWarn      Blocked     Failed      Total Run 
myname

Anybody have suggestions why this may happen?

Pasting View-Page Supply of the ultimate table which was produced.

<table border="1" cellspacing="0" cellpadding="0">
    <thead class="b">
        <tr bgcolor="WHITE">
            <th> Engineer</th>
            <th> Passed</th>
            <th> PWWarn</th>
            <th> Blocked</th>
            <th> Failed</th>
            <th> Total Run</th>
        </tr>
    </thead>
    <tbody class="h">
        <tr bgcolor="#F1F1F1">
            <td nowrap="nowrap">myname</td>
        </tr>
    </tbody>
</table>

Solution was discovered after getting in touch with the writer of SimplePostTemplate. It appears as though wordpress will remove bad HTML, which is what it did with my table, and therefore why it did not show correctly.

I could request another department to wash up their html before it reached wordpress, and therefore passing filters and fixing the problem.