Displaying Records Question.

7 posts by 2 authors in: Forums > CMS Builder
Last Post: January 22, 2009   (RSS)

By JoeKMT - January 21, 2009

I have created a monthly class schedule for a personal trainer, Monday through Saturday are available to have records added but right now not all days of the week have a class, what code would I use to 1. Display only if there is a record and 2.How do I make the table the records display in collapsible only showing the days there is a class.

Thanks!

Re: [JoeKMT] Displaying Records Question.

By Dave - January 21, 2009

Hi JoeKMT, welcome to the CMS Builder forum! :)

The first step is to create a mockup of how you want the schedule to look. Do you have a mockup that you can post the url to and/or can you attach your current viewer file?

It really depends on the layout of your page and setup of your section but you can check for records like this:

<?php if ($record): ?>
Display record content
<?php endif ?>

<?php if (!$record): ?>
There is no record.
<?php endif ?>

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [JoeKMT] Displaying Records Question.

By Dave - January 22, 2009

Hi Joe,

Are you using a single record or multi record section?

Looks like that link is gone but you can try something like this:

<?php if ($record['wedclass1']): ?>
<tr>
<td>Wednesday</td>
<td><?php $record['wedtime1'] ?></td>
<td><?php $record['wedclass1'] ?></td>
</tr>
<?php endif ?>

<?php if ($record['wedclass2']): ?>
<tr>
<td>&nbsp;</td>
<td><?php $record['wedtime2'] ?></td>
<td><?php $record['wedclass2'] ?></td>
</tr>
<?php endif ?>

...etc...


Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Displaying Records Question.

By JoeKMT - January 22, 2009

Sorry about the link, here it is again
http://irvine.directrouter.com/~alternat/pages/schedule.php

I think I understand the code you posted, it adds the table cells if there is a record to post, could still take a look at the link, let me know if you see anything wrong.

Thanks,

Joe

Re: [JoeKMT] Displaying Records Question.

By Dave - January 22, 2009

I can only see the html generated by the page. Not the php code itself, but the page looks good to me.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Displaying Records Question.

By JoeKMT - January 22, 2009

Thanks Dave for all of your timely help, I'll let you know if I get stuck again.

Joe