Category Order with two column split

2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 18, 2013   (RSS)

By Jason - June 18, 2013

Hi,

It looks like you're most of the way there.  What you need to do now is to retrieve your channel category records in the order you want them and then use that in your foreach loop.  In this code example, I've made the following assumptions:

  • Your table is called channel_category
  • This table has a field called "title", which is used as the label in the "wttv_channels" section.

The first thing we would do is get your records in their drag sort order and retrieve the title field:

<?php $headings = array_pluck(mysql_select("channel_category", "TRUE ORDER BY dragSortOrder DESC"), "title"); ?>

Next, we add an additional foreach loop to go through each of the headings records first:

<?php foreach ($headings as $heading): ?>
  <?php if (!array_key_exists($heading, $headingsToRecords)) { continue; } ?>
  <?php foreach ($headingsToRecords[$heading] as $channels): ?><tr>

Please note that this code is untested, and you may need to change some variable and field names to match your set up.

Hope this helps

---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/