Sorting a multi list

3 posts by 2 authors in: Forums > CMS Builder
Last Post: December 12   (RSS)

I'm drawing a complete blank on this... but how can I sort a multi-list so the records are reversed of their record entries in CMSB? I'm building a timline, so I do not want to sort by year because some of the timeline records have the same year. I just need to reverse the order the records appear.

  // load records from 'timeline'
  list($timelineRecords, $timelineMetaData) = getRecords(array(
    'tableName'   => 'timeline',
    'loadUploads' => true,
    'allowSearch' => false,
  ));


<?php if($about_usRecord['show_timeline'] =="1"): ?><!--- Timeline --->
<ul class="timeline">
<?php foreach ($timelineRecords as $record): ?> 
    
<li class="timeline-container timeliner">
    <div class="timeline-content">
        <div class="grid-x grid-margin-x align-center bottom-space">
            <div class="cell small-12 medium-6">
              <p class="timelineyears"><?php echo htmlencode($record['start_year']) ?><?php if(!$record['end_year'] ==""): ?> - <?php echo htmlencode($record['end_year']) ?><?php endif; ?></p>
              <h2><?php echo htmlencode($record['title']) ?></h2>
              <p><?php echo $record['content']; ?></p>
            </div>    
            <div class="cell small-12 medium-6 image_fiter">
              <?php foreach ($record['upload'] as $index => $upload): ?>
              <img src="<?php echo htmlencode($upload['urlPath']) ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="<?php echo htmlencode($record['title']) ?>">
              <?php endforeach ?> 
            </div>
        </div>    
    </div>
</li>
<?php endforeach ?>    
</ul>              
<!--- End Timeline ---><?php endif; ?>

Hey Djulia,

Thanks for the tip. I sorted it out using your tip and the line of code below. 

    'orderBy'     => 'num ASC', // or DESC

Have a great day!