Donor List display in two columns?
4 posts by 2 authors in: Forums > CMS Builder
Last Post: May 20, 2010 (RSS)
By zip222 - May 20, 2010
I am trying to figure a way to display a list of donors in two columns The donors come from a multi-record editor. When I am about half through the foreach loop, I need to insert "</td><td>"
Is there a way to do this?
Is there a way to do this?
Re: [zip222] Donor List display in two columns?
By Jason - May 20, 2010
Hi,
So you want to pretty much split the list of donors in half, half in each column. Is that right?
If you post the code you have already, I'll take a look at it for you.
Thanks.
So you want to pretty much split the list of donors in half, half in each column. Is that right?
If you post the code you have already, I'll take a look at it for you.
Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
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] Donor List display in two columns?
By zip222 - May 20, 2010
Yes, that is correct. Here is the code..
list($individualsRecords, $individualsMetaData) = getRecords(array(
'tableName' => 'individuals',
'loadUploads' => '0',
'allowSearch' => '0',
));
<table class="donors">
<tr>
<td>
<?php foreach ($individualsRecords as $record): ?>
<?php echo $record['name'] ?><br />
<?php endforeach ?>
</td>
</tr>
</table>
Re: [zip222] Donor List display in two columns?
By Jason - May 20, 2010
Hi,
You could try something like this:
This should set a new column approximately halfway through your list of records.
Give that a try and let me know if you run into any issues.
You could try something like this:
<?php
$half=intval($individualsMetaData['totalRecords']/2);
$count=0;
?>
<table class="donors">
<tr>
<td>
<?php foreach ($individualsRecords as $record): ?>
<?php if($count==$half): ?>
</td><td>
<?php endif ?>
<?php echo $record['name'] ?><br />
<?php $count++; ?>
<?php endforeach ?>
</td>
</tr>
</table>
This should set a new column approximately halfway through your list of records.
Give that a try and let me know if you run into any issues.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/