Sorting List By Country

8 posts by 3 authors in: Forums > CMS Builder
Last Post: January 19, 2011   (RSS)

By Joseph - January 10, 2011

i have a couple of minor issues on this page that i would like some help with.

Sorting Mas Band list by country
on the left hand side of the page it currently shows a list of all mas bands but i would only like to show the countries of the mas band so that when clicked the country opens up a new page with mas bands relevant to the country.
http://www.socanews.com/masbands/indexMas2.php

Thanks
Joseph
Attachments:

indexmas2.php 12K

Re: [socanews] Sorting List By Country

By Jason - January 10, 2011

Hi Joseph,

How are you storing country in the masband? Is it just text, or is it in a list field?

Also, do you have a page that will display all the bands of a single country? If so, could you attach that page?

Let me know and I can give you some examples.
---------------------------------------------------
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] Sorting List By Country

By Joseph - January 11, 2011

Hi Jason

The country are taken from a list field.

I dont have a physical page that list the bands by country i normally use this serch
http://www.socanews.com/masbands/index.php?country_keyword=trinidad

so for example the link above will shows bands from a particlar country Trinidad.

Joseph

Re: [chris] Sorting List By Country

By Joseph - January 17, 2011

Hi Chris
page has been attached.
Joseph
Attachments:

indexmas2_001.php 12K

Re: [socanews] Sorting List By Country

By Chris - January 18, 2011

Hi Joseph,

I think you want to output a list of links for your country field's list options. Is that right? If so, this code will do that for you:

<?php foreach (getListOptions('masbands', 'country') as $value => $label): ?>
<a href="/masbands/index.php?country_keyword=<?php echo htmlspecialchars($value) ?>">
<?php echo htmlspecialchars($label) ?>
</a>
<br/>
<?php endforeach ?>


Does that help? Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Sorting List By Country

By Joseph - January 18, 2011

Hi Chris
not sure exactly where that code should go on the page.
Joseph

Re: [socanews] Sorting List By Country

By Chris - January 19, 2011

Hi Joseph,

I'm guessing that you'd want to replace everything from <?php foreach ($masbandsRecords as $masbands): ?> to its corresponding <?php endforeach ?>.
All the best,
Chris