Trim last item?

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

By gkornbluth - November 21, 2015

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

By Daryl - November 23, 2015

Hi Jerry,

Is this a response to another forum post? Probably: http://www.interactivetools.com/forum/forum-posts.php?postNum=2237741

Did you create a new 'post' or clicked the 'reply' link? Just wondering if there's an issue with 'replying'  to a post.

Thanks,

Daryl Maximo
PHP Programmer - interactivetools.com

By Toledoh - November 23, 2015

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)