Working with ‘join’ code

3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 13, 2016   (RSS)

Hi All,

I’ve created a list page that shows the all the checked value labels in a list field for all user accounts (members).

I’m not sure how to exclude those records with only one value checked from my list page.

Here’s the simple code that I’m currently using with a comment in red to show what I’m looking for:

 <table class="text_font" width="100%" border="1"  cellspacing="0">
  <tr>
    <td style="padding-left:10px;">Last Name</td>
    <td style="padding-left:10px;">First Name</td>
    <td style="padding-left:10px;" colspan="3">Assignments</td>
   
  </tr>
 

<?php foreach ($accountsRecords as $record ): ?>
       <?php if ($record['allowedFolders'] ): // && $record['allowedFolders'] has more than one value ?>
     
      <tr>
    <td style="padding-left:10px;"><?php echo $record['last_name'] ?></td>
    <td style="padding-left:10px;"><?php echo $record['first_name'] ?></td>
    <td style="padding-left:10px;"><?php echo join(', ', $record['allowedFolders:labels']);?></td>
    
  </tr>
       <?php endif?>
          <?php endforeach; ?>
       </table>

Thanks as always,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gkornbluth - April 13, 2016 - edited: April 13, 2016

A perfect and elegant solution, and definitely a new recipe for the cookbook.

Thank you again, Damon,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php