Exactly - which is why I store output HTML in files.
In fact, a maybe better approach would be to store all the HTML modules you use in a database, which would completely save the need for any HTML in business logic. (I think).
For example, if you had a simple shopping cart, you could have the following rows in the table to show it:
CartHeader
Code html:
<table>
<tr><th>Product Code</th><th>Item Description</th><th>Price</th></tr>
CartRow
Code html:
<tr><td>%1$s</td><td>%2$s</td><td>£%3$s</td></tr>
CartFooter
(Maybe that's a bit of a long-winded approach - it's an example

)
Then you could use the following:
PHP Code:
<?
$getHtml_Top = mysql_query("SELECT html_output FROM html WHERE name='CartHeader'");
$getHtml_Row = mysql_query("SELECT html_output FROM html WHERE name='CartRow'");
$getHtml_Bottom = mysql_query("SELECT html_output FROM html WHERE name='CartFooter'");
$top = mysql_result($getHtml_Top, 0);
$row = mysql_result($getHtml_Row, 0);
$bottom = mysql_result($getHtml_Bottom);
echo $top;
foreach($_SESSION['cart'] AS $item){
printf($row, $item, getDescription($item), getPrice($item));
}
echo $bottom;
it was a bad example, but if your that desperate to separate logic from HTML, it works.
Bookmarks