Reputation: 1159
I am trying to print the content of the variable and a <hr>
tag after doing a check if the variable is not empty. The <hr>
is getting echoed even if the variable is empty.
Here is what I have
<?php if (!empty($content['relationship_graph'])){
print render($content['relationship_graph']);
echo '<hr>';
}
?>
Not very pro in PHP but looked at some documentation...Cant seem to figure out what I might be doing wrong
Upvotes: 0
Views: 165
Reputation: 1159
Here is what I ended up doing. It worked.
if($content['relationship_graph']['#markup']['length'] != 0){
print render($content['relationship_graph']);
echo '<hr>';
}
Upvotes: 0
Reputation: 1181
Value in it could be a blank space.
try..
<?php
if(!empty($content['relationship_graph']) && $content['relationship_graph']!=''){
print render($content['relationship_graph']);
echo '<hr>';
}
?>
Upvotes: 1