Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

PHP - if element is present or !empty - else if

0 votes
133 views
added Aug 8, 2019 in PHP by lcjr Second Warrant Officer (3,160 points)
edited Aug 21 by lcjr
<?php if (!empty($title)): ?>
  <h1 class="page-header"><?php print $title; ?></h1>
<?php endif; ?>

 

7 Responses

0 votes
responded Nov 8, 2019 by lcjr Second Warrant Officer (3,160 points)
//Show url if value !empty
<?php if(!empty($profile->field_company_name->value())): ?>  
   <div class="_row">
    <div>
      <i class="fa fa-certificate" aria-hidden="true"></i>
      <a href="/professional/<?php echo $profile->field_company_name_slug->value() ?>"><?php print $profile->field_company_name->value(); ?></a>
    </div>
   </div>
<?php endif;?>

 

0 votes
responded Aug 10 by lcjr Second Warrant Officer (3,160 points)
<?php if (!empty($field_logo)): ?>
  <img src="<?php echo $field_logo; ?>">
<?php endif; ?>

 

0 votes
responded Aug 10 by lcjr Second Warrant Officer (3,160 points)
<?php if($is_login){?>
if is_login exist, show this
<?php } ?>

<?php if(!$is_login){?>
    if its not, show this
<?php } ?>

 

0 votes
responded Aug 21 by lcjr Second Warrant Officer (3,160 points)
if($projectHome === false) {
  // do this
} else {
  // else do this
}

 

0 votes
responded Aug 21 by lcjr Second Warrant Officer (3,160 points)
<?php
  if ($nid == 1723635 || $nid == 1723633 || $nid == 1725398 || $nid == 1723634 || $nid == 1725434 || $nid == 1725486 || $nid == 1725493 || $nid == 1725518 || $nid == 1725523 || $nid == 1725528 || $nid == 1725528 || $nid == 1725533 || $nid == 1725541  ) {
    echo '<h2>Interested in XX Place?</h2>';
  } else {
    echo '<h2>Interested in this project?</h2>';
  }
?>

 

0 votes
responded Sep 2 by lcjr Second Warrant Officer (3,160 points)
<?php if($articleData->nid == 1727597) {?>
  @media (min-width: 768px) {
    .page-projectreview section.page-hero .news-hero-bg {
      background-position: center !important;
    }
  }
<?php } ?>

 

0 votes
responded Sep 2 by lcjr Second Warrant Officer (3,160 points)
<?php
  if ($field_source == 1727597 || $field_source == 1727601) {
    echo 'Register Your Interest in Park Place Now';
  } else if ($field_source == 1727602) {
    echo 'Register Your Interest in Park Regent Now';
  } else {
    echo "Drop your details if you'd like a sales consultant to contact you.";
  }
?>

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...