I have a Real Estate Website
Please can you tell me how to display items from a multi-value checkbox correctly;
In cmsAdmin, I use a field called 'features' set as multi-value checkbox and let's say someone checks the list of items like this:
[x] item 1
[x] item 2
[ ] item 3
[ ] item 4
[ ] item 5
[x] item 6
[ ] item 7
[x] item 8
In listingDetail.php I put in
<?php echo $listing['features'] ?>
and it would display the results like this:
item 1 item 2 item 6 item 8
I have two questions,
- What would I put in listingDetail.php if I want to display them like this (comma separated):
item 1, item 2, item 6, item 8
-
Ideally I would like to use CSS which displays icons, copy of the html on how I would want it to look after it had been processed below:-
<span class="features">
<span class="color-green"><i class="fa fa-check-square-o"></i></span>item 1
<span class="color-green"><i class="fa fa-check-square-o"></i></span>item 2
<span class="color-green"><i class="fa fa-check-square-o"></i></span>item 6
<span class="color-green"><i class="fa fa-check-square-o"></i></span>item 8
</span>
What code would I put in listingDetail.php if I want to display the items like the above?
More Information:
At the top of my listingDetail.php file I have the following code:-
<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */
require_once "init.php";
list($listingRecords, $listingDetails) = getRecords(array(
'tableName' => 'listings',
'joinTable' => 'homepages',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$listing = @$listingRecords[0];
if (!$listing) { print "Listing not found!"; exit; }
?>
I have spent hours on this so any help appreciated.
Thanks
Andy