
By Anonymous (not verified) on
Hello,
I've a type of content "company" (node--company.tpl.php) with a text field "field_facebook".
I would like show an image of an facebook icon with a link to url of the "field_facebook" content, but i can´t get it.
First, I checked the field is displayed correctly:
<?php if (!empty($node->field_facebook)):
print render($content['field_facebook']);
endif ?>
This shows "https://www.facebook.com/company" in the url of node. Ok.
Then, i´ve changed the php code for a facebook icon with a link of "field_facebook" content:
<?php if (!empty($node->field_facebook)): ?>
<a href="<?php echo ($content['field_facebook']); ?>"><img src="/img/icons/facebook.png" /></a>
<?php endif ?>
This shows the facebook icon, but the link is "http://www.mywebpage.com/Array".
I've a basic level of php and the error can be very silly and easy.
Thanks
Comments
If you are trying to
If you are trying to implement social network links there are modules that already do this.
Is there a module to
Is there a module to implement social network like a field in a type of content?
Ok, thanks. I will look for it.
Thanks Nevets
Try this search
Try this search
Finally, i installed "Social
Finally, i installed "Social Profile Field" module, and is ok.
Like I had to configure the "node - company.tpl.php" file for other reasons, I tried to do it directly with php and I didn't realize that there could be a module that would make it this easier.
Thanks Nevets