3 column list

4 posts by 2 authors in: Forums > CMS Builder
Last Post: October 26, 2011   (RSS)

Re: [degreesnorth] 3 column list

By Jason - June 23, 2011

Hi,

Is the issue formatting the column with CSS or getting the php script to automatically put information into the correct column?

If you could attach the .php file you are working on as well as a link to the output you're currently getting, we can try to make some suggestions.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] 3 column list

By degreesnorth - October 25, 2011

Hi Again

You had provided me with this code to enable 3 columns across a page. Just tried it on another website, and it's not working. http://keke3913.staging-zeus.netregistry.net/summary.php

The code is

<?php foreach ($listingsRecords as $record): ?>

<table border="0" cellpadding="0" cellspacing="0" width="228" id="table1">
<tr>
<td style="border-style: solid; border-width: 1px" bordercolor="#D4D5D6">
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table2">
<tr>
<td><img border="0" src="images/10w.gif" width="10" height="1"></td>
<td><img border="0" src="images/208.gif" width="208" height="1"></td>
<td><img border="0" src="images/10w.gif" width="10" height="1"></td>
</tr>
<tr>
<td><img border="0" src="images/9h.gif" width="1" height="9"></td>
<td><img border="0" src="images/9h.gif" width="1" height="9"></td>
<td><img border="0" src="images/9h.gif" width="1" height="9"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<p class="homeProductName"><?php echo $record['product'] ?></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td height="70" valign="top">
<p class="body"><?php echo $record['brief_descripton'] ?></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><a href="http://www.google.com.au/">
<img border="0" src="images/details_button.jpg" width="208" height="37"></a></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><img border="0" src="images/5h.gif" width="1" height="5"></td>
<td><img border="0" src="images/5h.gif" width="1" height="5"></td>
<td><img border="0" src="images/5h.gif" width="1" height="5"></td>
</tr>
</table>
</td>
</tr>
</table>

<?php $maxCols=3; if (@++$count % $maxCols == 0): ?></tr><tr><?php endif; ?> <?php endforeach ?> </tr>



Could you advise if this is possible, and if so HOW???????

Thanks in advance

Re: [degreesnorth] 3 column list

By Jason - October 26, 2011

Hi,

I think the issue here is that all of your table information is inside the foreach loop. So your entire nested structure is output for each record. What you need is to have your top level table outside the loop and your nested table inside.

For example:

<table border="0" cellpadding="0" cellspacing="0" width="228" id="table1">
<tr>


<?php foreach ($listingsRecords as $record): ?>
<td style="border-style: solid; border-width: 1px" bordercolor="#D4D5D6">
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table2">
<tr>
<td><img border="0" src="images/10w.gif" width="10" height="1"></td>
<td><img border="0" src="images/208.gif" width="208" height="1"></td>
<td><img border="0" src="images/10w.gif" width="10" height="1"></td>
</tr>

<tr>
<td><img border="0" src="images/9h.gif" width="1" height="9"></td>
<td><img border="0" src="images/9h.gif" width="1" height="9"></td>
<td><img border="0" src="images/9h.gif" width="1" height="9"></td>
</tr>

<tr>
<td>&nbsp;</td>
<td>
<p class="homeProductName"><?php echo $record['product'] ?></p></td>
<td>&nbsp;</td>
</tr>

<tr>
<td>&nbsp;</td>
<td height="70" valign="top">
<p class="body"><?php echo $record['brief_descripton'] ?></p></td>
<td>&nbsp;</td>
</tr>

<tr>
<td>&nbsp;</td>
<td><a href="http://www.google.com.au/">
<img border="0" src="images/details_button.jpg" width="208" height="37"></a></td>
<td>&nbsp;</td>
</tr>

<tr>
<td><img border="0" src="images/5h.gif" width="1" height="5"></td>
<td><img border="0" src="images/5h.gif" width="1" height="5"></td>
<td><img border="0" src="images/5h.gif" width="1" height="5"></td>
</tr>

</table>
</td>

<?php
$maxCols=3;
if (@++$count % $maxCols == 0): ?>
</tr><tr>
<?php endif; ?>
<?php endforeach ?>

</tr>
</table>


Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/