getting individual record numbers?

17 posts by 3 authors in: Forums > CMS Builder
Last Post: December 8, 2009   (RSS)

By Chris - December 7, 2009

Hi Jim,

There's a block of code above which checks to see if the year of the current record is different than the last record, if so, it closes off the table row and inserts a row for the year heading. If you try it out with 16 records (combinations of each of the 4 years and 4 regions) you'll see what I mean.

http://localhost/nawc/campaigns_list.php


Oops - localhost. I do this all the time too. ;)
All the best,
Chris

Re: [chris] getting individual record numbers?

By jimbly2 - December 7, 2009

Sorry Chris! Durr :-)

http://www.madhouse1.com/clients/nawc/campaigns_list.php

that's what I meant to do

Jim

By Chris - December 7, 2009

Hi Jim,

Have you tried the code I gave you above? Let's see how close it gets to your layout.
All the best,
Chris

Re: [chris] getting individual record numbers?

By jimbly2 - December 7, 2009

Hi Chris,

..yep I inserted the code below the existing table I created - at the bottom.
It breaks it into 4 columns but I'm not sure how to get it to match the styling?

best,

Jim

By Chris - December 7, 2009 - edited: December 7, 2009

Hi Jim,

I've simply chopped HTML out of your example table and spliced it into the new code, changes in red:

<table>
<tr>
<?php foreach ($resolutionsRecords as $record): ?>

<?php if ($record['year'] != @$currentYear): ?>
<?php if (@$currentYear): ?>
</tr><tr>
<?php endif ?>
<?php $currentYear = $record['year'] ?>
<?php $columnCount = 0 ?>

<td colspan="7">&nbsp;</td>
</tr><tr>
<td width="17">&nbsp;</td>
<td width="31" bgcolor="#99CCFF">&nbsp;</td>
<td width="17" bgcolor="#DAFBFF">&nbsp;</td>
<td colspan="4" bgcolor="#DAFBFF">

Resolutions passed at the <?php echo htmlspecialchars($currentYear) ?> Conference:
</td>
</tr><tr>
<?php endif ?>

<?php $columnCount++ ?>

<td colspan="3">&nbsp;</td>
<td align="left" valign="top" <?php echo $columnCount % 2 ? 'bgcolor="#FFFFCC"' : '' ?>"><p><span class="heads_campaign">
Region <?php echo $record['region'] ?></span><br />
<span class="bodytext_indent">
<a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

</td>
<?php endforeach ?>
</tr>
</table>


I hope this helps! Please let me know if you have any questions.
All the best,
Chris

By ross - December 8, 2009

Hi.

I had a look and I think the problem is going to be related to this line:

<td colspan="4" bgcolor="#DAFBFF">Resolutions passed at the 2008Conference:</td>

That colspan will need to be much higher. Try colspan="18". That will get it stretching all the way across.

Let me know what you think :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/