A website that I'm working on already has around 140 HTML files and each file contains a different HTML table. Each table has anywhere between 10 and approx 400 rows with 2 columns. This is old code which doesn't meet standards and at the moment I'm trying to make do with that old code.
Here's an example:
<TABLE BORDER=0>
<TR><TD><FONT SIZE=1>Row 1 Col 1</TD><TD WIDTH+20><FONT SIZE=1>Row 1 Col 2</TD><TR>
<TR><TD><FONT SIZE=1>Row 2 Col 1</TD><TD WIDTH+20><FONT SIZE=1>Row 2 Col 2</TD><TR>
<TR><TD><FONT SIZE=1>Row 3 Col 1</TD><TD WIDTH+20><FONT SIZE=1>Row 3 Col 2</TD><TR>
...
</TABLE>
I'm trying to find a way in PHP to count how many rows there are in the table, and then split the rows into 4 divs. So if we had a table with 100 rows. The first 25 rows would go into this div:
<div class="span3"><table>{first 25 rows go here}</table></div>
and so on...
<div class="span3"><table>{next 25 rows go here}</table></div>
<div class="span3"><table>{next 25 rows go here}</table></div>
<div class="span3"><table>{next 25 rows go here}</table></div>
until finally we get something resembling:
<div class="row-fluid">
<div class="span3"><table>{first 25% rows go here}</table></div>
<div class="span3"><table>{next 25% rows go here}</table></div>
<div class="span3"><table>{next 25% rows go here}</table></div>
<div class="span3"><table>{next 25% rows go here}</table></div>
</div>
All of this needs to be done without actually editing the code in the existing tables. Does anyone know how I'd do this with PHP?