Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I got errors with this code:
$node = node_load($data->nid);
$var1 = $node->body['und'][0]['value'];
$var2 = $node->field_bilder_f_r_die_galerie_2['und'][0]['value'] ;
if((!empty($var1)) || (isset($var2))){
echo "link";
}
else{
}
var_dump($var1);
var_dump($var2);
Everytime my variable is "NULL" i got this mistake. But some of my variables are NULL. What can i do ?
Error notice:
Notice: Undefined index: und in __lambda_func() (Zeile 3 von /home/bavramor/data/Webdesign/Webseiten/feuerwehr-germendorf/sites/all/modules/views_php/plugins/views/views_php_handler_field.inc(198) : runtime-created function).
Notice: Undefined index: und in __lambda_func() (Zeile 2 von /home/bavramor/data/Webdesign/Webseiten/feuerwehr-germendorf/sites/all/modules/views_php/plugins/views/views_php_handler_field.inc(198) : runtime-created function).
tested with :
7.x-1.0-alpha1
7.x-1.x-dev
any help would be appreciated
Comments
Comment #1
bavramor CreditAttribution: bavramor commentedThe mistake is here:
Now I write:
An all errors are gone,
Greetz Bav
Comment #2
priyankprajapati CreditAttribution: priyankprajapati commentedwhen i write this cod in global php filed then error will display like this.
Notice : Undefined index: 0 in __lambda_func() (line 5 of /var/www/html/java/drupal_fb/sites/all/modules/views_php/plugins/views/views_php_handler_field.inc(202) : runtime-created function)
how can i solve this error ???
Comment #3
priyankprajapati CreditAttribution: priyankprajapati commentedComment #4
fizk CreditAttribution: fizk commentedMaybe try
$data->field_field_date[0]['raw']['value']
instead of$data->field_field_date['0']['raw']['value']
Comment #5
NancyDruNote that
['und']
should be[LANGUAGE_NONE]
.Comment #6
fizk CreditAttribution: fizk commented