HTML block nested in PHP if statement - is this considered bad practice?
- by JYelton
Consider the following example:
<table>
<tr>
<td>Row One</td>
</tr>
<?php
if ($rowtwo)
{
?>
<tr>
<td>Row Two</td>
</tr>
<?php
}
?>
</table>
If $rowtwo is true, the second row is output, otherwise it is skipped.
The code works as desired, however I am evaluating Netbeans (7 beta) as a PHP IDE (instead of just using a text editor). Netbeans flags the code with an error:
Misplaced non-space characters insided
[sic] a table.
Should I consider an alternate way of writing this code, or is Netbeans incapable of understanding this flow control wrapper for HTML output?