Hi,

I'm currently working on a project which requires banners. I've decided to create these using html rather than images creating a content type responsible for the blocked content. The content type has the following fields:

Image
Body
Link

Ideally I'd like to create a custom tpl.php file for the content type and place the blocks created in the correct regions. If the block doesn't have anything in the link field then nothing will appear apart from the title, body and image (if entered). However, if the link is entered I would like to have an link surrounding the contents of the block with the value of the link field.

I've put this in place and modified the tpl.php file to check for a value in the link field. However I am getting warnings "Notice: Undefined index: field_link" for every occurrence of a nodeblock on the page (3 in total).

How do I theme the contents of a nodeblock like the contents of a node using the tpl.php file?

Comments

Johnny vd Laar’s picture

Status: Active » Closed (works as designed)

You need to check with an isset if the field_link exists.

vaccinemedia’s picture

Cheers! That'd do the trick. Just one of the many differences between Drupal 6 and 7 I guess.