I’m a PHP newb. Sorry if this is an FAQ…
Let’s say I have this HTML table:
<table width="100%" cellpadding="12" cellspacing="0" border="0">
<tr bgcolor="black">
<td align="left">
<img src="logo.gif" />
</td>
<td>
<h1>Hello</h1>
</td>
<td align="right">
<img src="logo.gif" />
</td>
</tr>
</table>
Instead of escaping to HTML (?> ... <?php) or using echo with manual string construction, I’d like to use PHP functions to generate the code. I cooked up a library so that the above example can be generated with this:
echo table(
array('width' => '100%', 'cellpadding' => '12', 'cellspacing' => '0', 'border' => '0'),
tr(
array('bgcolor' => 'black'),
td(
array('align' => 'left'),
img(array('src' => 'logo.gif'))),
td(array(), h1(array(), 'Hello')),
td(array('align' => 'right'), img(array('src' => 'logo.gif')))));
My question is, is there already a popular or commonly used library that does this?
I didn’t find a library so I’ve continued to update my own HTML tab library.