Unwanted space after record is called

5 posts by 3 authors in: Forums > CMS Builder
Last Post: May 22, 2013   (RSS)

By dccreatives - May 22, 2013

I have a code that I am calling  <?php echo $record['mounting-french']?>

After it gives me the record I wanted to add an 'S' to pluralize. <?php echo $record['mounting-french']?>S

However, it is giving me a space after the record so it has the record space and then the 's' Anyway to work around this?

This is the result:

SUSPENSION S where suspension is the record and the S is coming after a space.

I am attaching my page.

You can see it online here: 

http://www.axislighting.com/CMS_french/GalleryList.php?mounting-french=suspension

Please advise how I can remove the space

Attachments:

gallerylist_001.php 6K

By gkornbluth - May 22, 2013 - edited: May 22, 2013

Hi dccreatives,

I might have missed something but i can't see any reason in your code why there should be a space.

I thought it might be an errant space with the <?php echo $record['mounting-french']?> and S being on a separate code line, but it's not.

I'd suggest putting the <?php foreach ($galleryRecords as $record): ?> inside the div and after Galerie Photos -, like this:

   <div class="breadcrumbs">
 Galerie Photos -  <?php foreach ($galleryRecords as $record): ?><?php echo $record['mounting-french']?>S<?php break ?><?php endforeach ?>

</div>

Silly question, but are you sure that there isn't a space in the field entry itself after SUSPENSION? (I just looked, and you're getting the space after all the titles so there probably isn't but I thought I'd ask anyway.)

Is mounting-french a text field?

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 gregThomas - May 22, 2013

Hi,

I would try using the PHP function trim, this will remove any white spaces from the beginning or end of your variables:

<?php echo trim($record['mounting-french'])?>S

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By dccreatives - May 22, 2013

I found the issue. I regenerated the code and got this: <?php echo join(', ', $record['mounting-french:values']); ?>S

That worked without a space.