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

PHP - if element is present or !empty

0 votes
added Aug 8, 2019 in PHP by lcjr Staff Sergeant (2,800 points)
<?php if (!empty($title)): ?>
  <h1 class="page-header"><?php print $title; ?></h1>
<?php endif; ?>


1 Response

0 votes
responded Nov 8, 2019 by lcjr Staff Sergeant (2,800 points)
//Show url if value !empty
<?php if(!empty($profile->field_company_name->value())): ?>  
   <div class="_row">
      <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>
<?php endif;?> - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.