Originally Posted by
mc12345678
I managed to put address entries into a table by adding code to 'tpl_modules_checkout_address_book.php'
Code:
<table width="100%"><?php $tablecounter++;
if (($tablecounter % 2) == 1) {
?><tr>
<?php }
?><td width="50%">......
</td><?php
if (($tablecounter % 2) == 0) {
?></tr>
<?php }
$addresses->MoveNext();
}
?> </td></tr></table>
But all 5 entries are squeezed in the same row.
How to move 3rd&4th entries in the second row and 5th entry in the third row?
Thank you.
I changed the above code, but didn't provide "highlights". Please review for applicability.
Also, before the loop that starts the while, set $tablecounter = 0;
Also just realized that there may be some validation issues...
The <table width...> should only be applied one time at the first time the table is displayed... All subsequent portions of the table should be built from row (<tr>) and column(<td>). So if the below code is fully within the while loop, then:
Code:
other php...
if ($tablecounter == 0) { // If the tablecounter hasn't been incremented then initiate a new table one time while this code is within the while loop.
?>
<table width="100%">
<?php } // EOF if ($tablecounter == 0)
$tablecounter++; // increments the table counter by 1
if (($tablecounter % 2) == 1) { // If the counter modulus 2 (number of columns) is 1 (first cell in any series of columns) then initiate a new row
?><tr>
<?php }
?><td width="50%">...... (this section outputs the address data)
</td><?php // closes the cell in that row
if (($tablecounter % 2) == 0) { // If the counter represents the end of the row by counter modulus 2 then close the row.
?></tr>
<?php }
$addresses->MoveNext();
}
if (($tablecounter % 2) == 1) { // If the above loop completed leaving an odd number of cells, then the row needs to be closed before closing the table.
?></tr>
<?php } ?>
</table>
Bookmarks