1

I've got another question about undefined index that I can use help with.

The error message I get is: Notice: Undefined index: field_brand_image in include() on line 15

I'm pretty sure that this is the same lnaguage and "und" portion of the field array issue I had in my other question here: Notice: Undefined index: und in include()

And only displays when the field is empty

Except this time the error is coming from a views template, the line throwing the error looks like:

php print $fields['field_brand_image']->content;

I "think" the answer involves an isset conditional, but I don't know what the syntax should be. I'm using D7.23 and views 7.x-2.3

I'd appreciate some help. Thanks.

1 Answer 1

1

One way of doing that is using a empty to check the field as following:

<?php print (!empty($fields['field_brand_image'])) ? 
  $fields['field_brand_image']->content : ''; ?>
3
  • Just empty on its own is enough. It doesn't give an error when the expression does not exist. Commented Oct 23, 2013 at 16:53
  • @AlfredArmstrong Yeah right, Thanks for correcting me Commented Oct 23, 2013 at 16:56
  • Thank you both again for the help, I really do appreciate it.
    – StephanieF
    Commented Oct 23, 2013 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.