Hi guys, i am trying to output some user profile fields value in joomla article.
What i need is to build an "if" statement that will output the code only if the field have a value.
What i did so far
1. I am getting the author ID of the article like this
2. I am setting-up variables for the fields i need
3. Now, finally, i am trying to "output" those fields ONLY if the field have value ... but it doesn't work
... and so on
How to build that "if" statement in order to output the field only if it contains value ?
Thanks !
What i need is to build an "if" statement that will output the code only if the field have a value.
What i did so far
1. I am getting the author ID of the article like this
$authorid = $this->item->created_by ? $this->item->created_by : $this->item->author;
2. I am setting-up variables for the fields i need
//Author Extended Profile Info
$author_city = Foundry::user($authorid)->getFieldValue('ADDRESS')->value->city;
$author_state = Foundry::user($authorid)->getFieldValue('ADDRESS')->value->state;
$author_about = Foundry::user($authorid)->getFieldValue('ABOUT');
$user_website = Foundry::user($authorid)->getFieldValue('URL');
3. Now, finally, i am trying to "output" those fields ONLY if the field have value ... but it doesn't work
<?php if( $author_about ){ ?>
<?php echo $author_about;?>
<?php } ?>
<?php if( $user_website ){ ?>
<a href="http://<?php echo $user_website; ?>/" rel="nofollow" target="_blank"><?php echo $user_website; ?></a>
<?php } ?>
... and so on
How to build that "if" statement in order to output the field only if it contains value ?
Thanks !