I have the following condition, which says that if $img[$i] is true, then an image will be created in the code:
<?= !$img[$i] ? "" : "<div class=\"image\"> <img src=\"/images/1.gif\" /></div>"; ?>
I want to add another condition that says that if $center=true, then a class called centered will be added to the image, so eventually code will look like:
<div class="image"><img src="images/1.gif" class="centered"/></div>
So basically this means putting another condition inside the previous condition, but I can't simply add !$center ? '' : ' class="centered"' in the middle of the code.
How can I achieve this?
Aucun commentaire:
Enregistrer un commentaire