I am displaying a Google map on my website which loops through a number of values based on their co-ordinates in the database.
There are four different types of partners and these are highlighted with different coloured marker pins.
So far I am successfully showing 3 different coloured markers using a shorthand if-else statement. How can I add one more condition in to this to show my final coloured marker for Type4?
<?php
$markers = array();
foreach ($current as $key => $value) {
$markers[] = array(
'latLng' => array($value['Partner']['lat'], $value['Partner']['lon']),
'options' => array(
'icon' => $this->Html->url('/img/icons/'.($value['Partner']['type1'] ? 'pink-pin.png' : ($value['Partner']['type2'] ? 'green-pin.png' : 'purple-pin.png'))),
),
'data' => array(
'html' =>
'<p>'.$value['Partner']['name'].'</p>'
),
);
}
?>
Aucun commentaire:
Enregistrer un commentaire