<div class="botontour"><a href="<?php echo $currentItem['video'];?
>">Video Tour 3D</a></div>
I want to hide the entire "botontour" div if the php echo has no return.
in this case you can check if it's empty :
<?php
if (!empty($currentItem['video'])) {
?>
<div class="botontour"><a href="<?= $currentItem['video'];?>">Video Tour 3D</a></div>
<?php
}
?>
<?php
if(isset($currentItem['video']) && !empty($currentItem['video'])){
?>
<div class="botontour"><a href="<?= $currentItem['video'];?>">Video Tour 3D</a></div>
<?php } >
empty — Determine whether a variable is empty
<?php
if(!empty($currentItem['video'])) { ?>
<div class="botontour"><a href="<?php echo $currentItem['video'];
>">Video Tour 3D</a></div>
<?php } ?>
You can use strlen() : http://php.net/manual/fr/function.strlen.php
<?php if(strlen($currentItem['video']) != 0) { ?>
<div class="botontour"><a href="<?php echo $currentItem['video'];?
>">Video Tour 3D</a></div>
<?php } ?>
Or Empty() : http://php.net/manual/fr/function.empty.php
<?php if(!empty($currentItem['video'])) { ?>
<div class="botontour"><a href="<?php echo $currentItem['video'];?
>">Video Tour 3D</a></div>
<?php } ?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.