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

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

 

1 Response

0 votes
responded Nov 8 by lcjr Sergeant (1,540 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;?>

 

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