Trim last item?

4 posts by 3 authors in: Forums > CMS Builder
Last Post: November 23, 2015   (RSS)

Hi Tim.

Here's what I've been using to trim the last comma. It might work for you:

<?php 
    $output 
''
    foreach (
$home_page_slide_showRecord['images'] as $upload) { 
      
$output .= '{ src: ' '"' .$upload['thumbUrlPath']. '"' '}'','
    } 
    
$output rtrim($output,','); // remove trailing comma 
    
print $output
?>

Best,

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

Daryl.

There was to copies of the thread created from my original post.  I then tried to delete one, but ended up just deleting my comments, not the whole thread.

Cheers,

Tim (toledoh.com.au)

By Daryl - November 23, 2015

I see, thanks Tim!

Daryl Maximo
PHP Programmer - interactivetools.com