PHP - if, else, elseif condition

0 votes
1,653 views
added Mar 27, 2018 in PHP by LC Marshal Captain (25,770 points)
edited Jul 20, 2018 by LC Marshal
// If $bedrooms is not empty, show the .hidden-t-m elements

<?php if (!empty($bedrooms)): ?>
    <div class="hidden-t-m"><?php print $bedrooms ?> Beds</div> 
<?php endif; ?>

 

24 Responses

0 votes
responded Sep 24, 2019 by lcjr First Warrant Officer (9,190 points)
<?php
  if($isPro){
      require_once('page--type-projects--pro.php');
  }elseif($isContest){
      require_once('page--type-projects--contest.php');
  }else{
    echo 'Node owner is neither pro nor contest.';exit;
  }

?>

 

0 votes
responded Mar 12, 2020 by LC Marshal Captain (25,770 points)
<?php if($epick == 0) {?>
    <span class="cat-meta">
      <a href="/news/search?field_category_value=<?php echo $filter['field_category_value'];?>&combine="><?php echo $search->field_category;?></a>
    </span>
<?php } ?>

 

0 votes
responded Jul 1 by lcjr First Warrant Officer (9,190 points)
<?php  if ( ($news_category == 'news') ) { ?>
  <a href="/news" rel="category tag"><?php echo $news_category;?></a>
<?php } else { ?>
  <a href="/news/search?field_category_value=<?php echo $news_category;?>&combine=" rel="category tag"><?php echo $news_category;?></a>
<?php } ?>

 

0 votes
responded Jul 21 by lcjr First Warrant Officer (9,190 points)
<?php if($nid == 1903018 || $nid == 1903088):?>
lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...