Hi,
Great script, so far I'm really pleased.
I could do with a little help though:
I want to place each record into a table cell, table to be 2 columns wide.
So each record would be placed in:
Row 1 - column 1 then column 2
New row - column 1 then column 2 and so on.
Looking at previous posts, I'm sure I need to create a counter and use a <td></td>
for each record and a </tr><tr>
for every second record but can't get this right.
Your help would be greatly appreciated.
Kind regards
Hi David,
Amazingly fast response and that piece of code did the trick.
Thank you so much.
Hi!
Try something like this (i've only included the relevant code here):
<?php
$columns = 2;
$current_column = 0;
function myRecordHandler($record)
{
global $columns;
global $current_column;
print "<td>";
// ****************************
// display record contents here
// ****************************
print "</td>";
$current_column++;
if ($current_column == $columns)
{
print "</tr><tr>";
$current_column = 0;
}
}
print "<table>";
print "<tr>";
MagicParser_parse("filename.xml","myRecordHandler","xml|FORMAT/STRING/");
print "</tr>";
print "</table>";
?>
That's the basic structure you need!
Hope this helps,
Cheers,
David.