I noticed halls was using the following structure to assemble a HTML table:
Code: Select all
echo "<table><tr>";
echo "<td></td>";
echo "</tr></table>";
Code: Select all
echo "
<table><tr>
<td></td>
</tr></table>"
;
Code: Select all
echo "<table><tr>";
echo "<td></td>";
echo "</tr></table>";
Code: Select all
echo "
<table><tr>
<td></td>
</tr></table>"
;
Code: Select all
echo "<table> <tr>\n <td></td> \n</tr> </table>";
Code: Select all
<?php if( $var == $val ) : ?>
<table>
<tr>
<td></td>
</tr>
</table>
<?php endif; ?>
I think you mean this method? It isn't normally supported in PHP. Is actually used in Perl. It's called EOF.Jackolantern wrote:Isn't there some alternative method as well? I can't remember what the keyword is called, but you use it and create an end label, type in as much verbatim HTML as you want, and then use your end label to break back into PHP. I never use it, but someone mentioned it on here one time.
Code: Select all
echo <<< KEYWORD
<table>
<tr>
<td></td>
</tr>
</table>
KEYWORD;
Yep, that is the method I use! Only downside is that it can start to get a bit ugly if you do have a lot of HTML, but have to periodically jump back into PHP. However, that can be at least partially fixed by something like Smarty for big projects.Chris wrote:No need for an echo here:Code: Select all
<?php if( $var == $val ) : ?> <table> <tr> <td></td> </tr> </table> <?php endif; ?>
And yes, that is the one I was thinking of! I had actually never used it before.Chris wrote:I think you mean this method? It isn't normally supported in PHP. Is actually used in Perl. It's called EOF.Jackolantern wrote:Isn't there some alternative method as well? I can't remember what the keyword is called, but you use it and create an end label, type in as much verbatim HTML as you want, and then use your end label to break back into PHP. I never use it, but someone mentioned it on here one time.Code: Select all
echo <<< KEYWORD <table> <tr> <td></td> </tr> </table> KEYWORD;