In one of my content types I have a PDF link using FileField to upload it.

I have some code to automatically replace the filename with "Technical information »".

<div class="download"><a href="<?php global $base_url; print $base_url . '/' . $field_download[0][filepath]; ?>" target="_blank">Technical information pdf »</a></div>

However, sometimes there is no PDF so I want to hide the "Technical information »" when this is the case.

I've tried this code:

<?php if (!empty($field_download)): ?>
    <div class="download"><a href="<?php global $base_url; print $base_url . '/' . $field_download[0][filepath]; ?>" target="_blank">Technical information pdf »</a></div>
    <?php endif; ?>

But with no effect.

However, if I change the code to empty (rather than !empty) they all disappear (whether there is a PDF or not). So I'm thinking that the code is right, but for some reason it always thinks there is something in the field.

Can anyone help? It's driving me nuts!

Comments

podsnap’s picture

*bump*

Sorry to bump this, but does anyone have any idea where I might be going wrong?