Remove commas from join in Code Generator-created code
2 posts by 2 authors in: Forums > CMS Builder
Last Post: March 4, 2014 (RSS)
By benedict - March 3, 2014
Hi guys, just a quick question with hopefully a simple fix.
I have a products section where products are assigned one or more categories using a list field (Check boxes).
When I use the code generator, it spits out this:
Category (labels): <?php echo join(', ', $record['category:labels']); ?>
Which outputs the selected categories like this e.g. Home, Business
How do I get rid of the comma that separates the two selected categories? I know it's something to do with the ', ', just after join, but my random noodling has born no fruit.
Cheers,
B
By Chris - March 4, 2014
Hi benedict,
Do you want them separated by spaces?
Category (labels): <?php echo join(' ', $record['category:labels']); ?>
...should give you e.g. Home Business
Category (labels): <?php echo join('', $record['category:labels']); ?>
...should give you e.g. HomeBusiness
Hope this helps!
Chris