0

On only one of my four registered domain names (foo.com, www.foo.com, foo.fr and www.foo.fr) am I'm getting undefined index errors such as:

Notice: Undefined index: vignettes in custom_page_preprocess_charger_accueil() (line 978 of /homez.119/retronom/www/sites/all/modules/custom/custom_page/custom_page.module).

The www.foo.com subdomain spits out these errors and is set up as a CNAME to foo.com. I'm really stumped as to how this could affect only one of the subdomains. What could cause these kinds of errors only on one?

Code setting up $varTemp:

//Vignette
if ($node->field_type['und']['0']['value'] == 1 && $node->language == $GLOBALS['language_url']->language) {
  $varTemp['vignettes'][$j]['image'] = theme('image_style', array (
    'style_name' => 'quick_link',
    'path'       => $node->field_image['und']['0']['filename'], 
    'alt'        => $node->field_image['und']['0']['alt'],
    'title'      => $node->field_image['und']['0']['title'],
  ));

  $varTemp['vignettes'][$j]['link'] = $node->field_lien_site['und']['0']['value'];

Code that is failing:

While ($j != count($varTemp['vignettes'])) {  <-- Line 978
  if ($varTemp['vignettes'][$i]) {
    if ($varTemp['vignettes'][$i]['column'] == 'A') {
      $vars['vignettes']['A'][$a]['image'] = $varTemp['vignettes'][$i]['image'];
      $vars['vignettes']['A'][$a]['link'] = $varTemp['vignettes'][$i]['link'];
      $vars['vignettes']['A'][$a]['ombre'] = $varTemp['vignettes'][$i]['ombre'];
      $vars['vignettes']['A'][$a]['title_link'] = $varTemp['vignettes'][$i]['title_link'];
      if (isset($varTemp['vignettes'][$i]['body'])) {
        $vars['vignettes']['A'][$a]['body'] = $varTemp['vignettes'][$i]['body'];
      }
      $a++;
    ...
    snip
    ...
}
3
  • Please provide the code for your function, specifically line 978 of your module file. Oct 12, 2013 at 18:39
  • @ScottJoudry code added
    – Slugart
    Oct 12, 2013 at 21:03
  • I've posted an answer. There isn't enough info here to be sure it will help, but even if it's not the final solution, please implement the suggested solution and update your question if that doesn't help.
    – Letharion
    Oct 12, 2013 at 21:39

1 Answer 1

0

Since you don't say anything about any debugging effort, it's hard to say, but one thing repeatedly stands out as clearly wrong

$node->field_X['und']['0']

which should always be

field_get_items($node, 'field_X);

Since your domains are foo.com, www.foo.com, foo.fr and www.foo.fr, this might indicate that you use more than one language, which is exactly when ['und']['0'] is likely to break for you. Notice that field_get_items() will return an array instead of a single value, so you will need to amend your code to deal with that.

1
  • The site is only in french, i've checked the content and there is none in any other language. Also all 4 domains should redirect to the same site. I'm just picking up this project and don't even have a dev site setup yet so in the mean time i've just redirected the www.foo.com domain to foo.com. Thanks for you time and help though.
    – Slugart
    Oct 13, 2013 at 13:06

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.