I have a boolean single check-box field. and inside my node--content-type.tpl.php Idothe following check:
<?php if($content['field_hide_1st_line_of_the_addre']['und'][0]['value'] == 0): { ?>
<?php print render($content['field_images']['#object']->field_location['und'][0]['street']) . t(', '); ?>
<?php } else: { ?>
<?php print t(''); ?>
<?php } endif; ?>
And it returns loads of "Notice: Undefined index: und in include() (line 80 of node--content-type.tpl.php"
Any idea what is going on?
UPDATE
<?php if (isset($content['field_hide_1st_line_of_the_addre']['und'][0]['value'])): { ?>
<?php print render($content['field_images']['#object']->field_location['und'][0]['street']) . t(', '); ?>
<?php } else: { ?>
<?php print t(''); ?>
<?php } endif; ?>
is not the doing the check correctly: the Street field disappears forallteasers,while it should only disappear for those that have the boolean check-box ticked.
UPDATE 2 This code didn't work either. Pave me a Parse error: syntax error, unexpected $end
<?php
if (isset($content['field_hide_1st_line_of_the_addre'][LANGUAGE_NONE][0]['value'])) :
if($content['field_hide_1st_line_of_the_addre']['und'][0]['value'] == 0): { ;
print render($content['field_images']['#object']->field_location['und'][0]['street']) . t(', ');
} endif;
?>
UPDATE 3
I deleted that old field and created a new identical one. Tried many things,but it turns out that for some unknown reason it just didn't like the 0 and preferred 1 instead.So I used 1,and just changed the wording of the field from "Hide full address" to "Display full address". This is the code that worked for me. If you seeany syntax mistakes,pleaselet me know.
<?php
if (isset($content['field_hide_address']['#items'][0]['value'])) :
if($content['field_hide_address']['#items']['0']['value'] == '1'):
print render($content['field_images']['#object']->field_location['und'][0]['street']) . t(', ');
endif;
endif; ?>