Forum Moderators: coopster
echo '<table border = "1">' . "\n";
echo '<tr>' . "\n";
echo '<td> row one, cell one <td>' . "\n";
echo '<td> row one, cell two <td>' . "\n";
echo '</tr>' . "\n";
Is there a more simple way to format the html so it comes out on separate lines or is the format I have now probably the best route?
--Nick
alternate format
echo '<table border = "1">',"\n";
echo '<tr>',"\n";
echo '<td> row one, cell one <td>',"\n";
echo '<td> row one, cell two <td>',"\n";
echo '</tr>',"\n";
or you could use double quotes for anything that doesn't include double quotes
echo '<table border = "1">',"\n";
echo "<tr>\n";
echo "<td> row one, cell one <td>\n";
echo "<td> row one, cell two <td>\n";
echo "</tr>\n";
doesn't really matter
echo <<<END
<table>
<tr>
<td>$yourVar</td>
</tr>
</table>
END;
and I use this a lot:
2) Turning php on and off
<?php
foreach ($thing as $thingy){
?>//turn off php
<td>
<div><a href='<?=$url?>'><?=$someting?></a><?=$thing?></div>
</td>
<?php // turn php back on
}
Haven't checked this code obviously, but the ideas are there. Hope it helps.