Filtering list

4 posts by 2 authors in: Forums > CMS Builder
Last Post: April 8, 2009   (RSS)

By s2smedia - March 25, 2009

Ok heres my issue...

I have a page that lists "programs"

you can click on a certain "program" and it will take you to a program "details" page

on this details page I would like it to show a listing of the "locations" this program is available in.

* when creating a program in the cms I have a section to select (checkbox) what location this program is available in.

so for example... in my viewer code i would use this:
<?php echo join(', ', getListLabels('programs', 'summer_academy', $programsRecord['summer_academy'])); ?>


The thing i want to do now is actually pull in the location listing and have that filtered by what locations are selected in the above checkbox's

So here would be my code (this lists ALL summer_academy locations, I need it to only list the locations that were selected when creating the program:

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

<table width="300" border="0" cellspacing="0">
<tr>
<td width="68" align="left" valign="top" style="padding:8px 8px 8px 0px"><?php foreach ($record['location_image'] as $upload): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="40" height="30" alt="Locations" /><br/>
<?php endforeach ?></td>
<td width="429" align="left" valign="top" style="padding:10px 0px 10px 0px"><span class="smallsubheader2"> <a href="<?php echo $record['_link'] ?>"><?php echo $record['location'] ?></a></span><br />
<span class="newsheadlines3"><?php echo $record['address'] ?></span></td>
</tr>
</table>

<?php endforeach; ?>

<?php if (!$summer_academy_locationsRecords): ?>
<?php endif ?>

Re: [s2smedia] Filtering list

By ross - March 26, 2009

Hi there.

Thanks for posting!

Do you have a link I can check this out at? I am not quite sure I understand how you have this setup.

My first though though is if you have a bunch of check boxes in the admin section for each program so you can choose which locations, couldn't we just output any checkboxes you've selected?

The code for that would look something like this:

<?php if $record['North Sunnybrooke']: ?>
North Sunnybrooke
<?php endif ?>

And then you just repeat that for each checkbox. Each one that you've checked off will display its name.

Let me know if that sounds like it would work and get me a link to check it all out at.

Thanks!
-----------------------------------------------------------
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/

Re: [ross] Filtering list

By s2smedia - March 26, 2009

Hey Ross,

Thanks for the reply.. its a little trickier than that. mainly because the locations and programs are always changing so i cant hard code anything in.

apexsoccer.com

a page you can see what im working on for this particular coding is:
http://www.apexsoccer.com/programs_detailsT.php?Monday-Training-Supplement-16

The box that has the "program locations"...
I need it to only display the locations that offer the particular program page they are viewing.

When setting up a program in the CMS... I have a section that lists all locations and then you check next to each one that offers the program.

Let me know if you have any other ?'s

Thanks!!