Hide fields

aje

Member
Hi
i am making a custom template

Have a text field with an facebook url. I want it to show this if its contains an url and be hidden if its empty.
The label should be standard "visit our facebook page"

How can i solve this ? Have tried to get this to work but i am having trouble with the hidden part and also i get som divs with the field.

i am using this to show the field
$facebook = $elements['facebook']->element;

and <?php echo $facebook; ?>
 
nothing, but i want the link name i would like to be "visit our facebook" and not the url (but the url as a link). But i am not sure how to do this.
 
->element is the rendered element.

Try
$facebook = $elements['facebook']->element_raw;

echo '<a href="' . $facebook . '">your text to show</a>';
 
Works when i have an url but if url isnt there i get the same text linking to nothing but site root
 
A little bit of php

if (!empty($facebook)) echo '<a href="' . $facebook . '">your text to show</a>';
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top