Sub Grouping in List Views - One Way of Doing It.

14 posts by 6 authors in: Forums > CMS Builder
Last Post: March 12, 2010   (RSS)

By Chris - October 20, 2009

Hi rez,

You can use the getListLabels() function to lookup the label for a num in a List field. You'll need to supply that function with the name of the table and field it's doing the lookup from:

$tableName = 'food';
$fieldName = 'group';
$fieldValue = $record['group'];
$label = getListLabels($tableName, $fieldName, $fieldValue);
echo $label;


Change the code in red above to reflect your configuration. Please let me know if you have any questions or run into any problems.
All the best,
Chris

By Chris - March 9, 2010

Hi rez,

How about replacing this line:

<h2 class="menu-category"><?php echo $group ?></h2></div></div> <!-- this is where the number is echoed, i want category titles. -->

with this:

<h2 class="menu-category"><?php
$labels = getListLabels('beverage_items', 'category', $record['category']);
echo join('<br/>', $labels);
?></h2></div></div> <!-- this is where the number is echoed, i want category titles. -->


Does that help?
All the best,
Chris

Re: [chris] Sub Grouping in List Views - One Way of Doing It.

By rez - March 12, 2010

It's working great, yes. Thanks.