Do not print comma after last image - what markup?

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

Re: [zaba] Do not print comma after last image - what markup?

By Jason - December 15, 2010

Hi,

You can use rtrim to remove the last comma at the right of the string:

<?php foreach ($gallery_villa_ambasadaRecord['images'] as $upload): ?>
<?php if ($upload['isImage']): ?>
<?php $gallery_va.="'"; ?>
<?php $gallery_va.=$upload['urlPath']; ?>
<?php $gallery_va.="',"; ?>
<?php endif ?>
<?php endforeach ?>
<?php $gallery_va=rtrim($gallery_va,',');?>
<?php $gallery_va.="

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Do not print comma after last image - what markup?

By zaba - December 15, 2010

Perfect!
thanks a million!