phpmoduledrupal-7drupal-viewswsod

WSOD using Drupal 6 module code in Drupal 7?


Here is my code which worked perfectly in Drupal 6 but gives me a blank white page WSOD in Drupal 7.15 and views 7.x-3.3;

<?php

function ajaxview_menu() {

  $items = array();

  $items['replies'] = array(
    'title' => 'Replies',
    'page callback' => 'ajaxview_replies',
    'description' => 'Replies',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );

  return $items;
}

function ajaxview_replies($nid) {
  $node = node_load($nid);
  $viewName = 'Replies'; 
  $display_id = 'default'; 
  $myArgs = array($nid); 
  print views_embed_view($viewName, $display_id, $myArgs);
 exit();
}

What has changed and what am I doing wrong?


Solution

  • Apologies it was a stupid mistake.

    The machine name for $viewName was "replies" not "Replies".

    Doh!