Answer the question
In order to leave comments, you need to log in
How to write a condition if the variable is equal to -1?
In Joomla, if you select "Nothing selected", the variable is set to -1.
How to correctly write a condition so that if the $music variable is equal to -1, then the block is not shown?
<?php ... { ?>
<!-- audio -->
<div class="player">
<audio id="player" src="<?php echo $music ?>" loop="loop" preload="auto"></audio>
<div class="player__btn"></div>
</div>
<!-- /audio -->
<?php } ?>
<!-- audio -->
<div class="player">
<audio id="player" src="-1" loop="loop" preload="auto"></audio>
<div class="player__btn"></div>
</div>
<!-- /audio -->
Answer the question
In order to leave comments, you need to log in
<?php if($music != -1) { ?>
Or is there something wrong here? :-)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question