On the node page, my nodes of type quiz are empty; there is no nid, teaser, and the date is wrong (12/31/1967).

I have exhausted myself looking at the code of this module and SQL database to see if there is something wrong in the _view hook or table contents.

Here is the link to the problem page ...

And here is the direct link to the working quiz node ...

I am hoping that someone can give advice. I don't know how these values are assigned to the teaser box.

Comments

223p’s picture

I copied the example in the story module:

function story_view(&$node, $main = 0)
{
  // This function is called by node.module when an story node is viewed. This
  // lets story.module do some processing to the node before outputting 
  global $theme;

And this fixed it. My code forgot the & operator on $node and I mistakenly declared $node as a global variable. Oops!

Looking at the theme, I am understanding how this hook works. If $main is 1 in the if else statement than it calls my node->teaser variable, if it is 0 then it calls my custom node view!

I posted earlier, if anyone wanted to help me develop this module. But since nobody answered I have been figuring out for 10 months now- how this Drupal works!

Basically what my quiz module does is combine a basic node module (body and teaser fields) with a java applet to result in an interactive page that takes the tab-delimited quiz data and presents as a multiple choice quiz that users can advance through.

223p’s picture

Even though I fixed the the _view hook of my module, I still don't understand what was going on.


// correct syntax for _view hook
function story_view(&$node, $main = 0){}

// what does '&' mean?
// What is the difference between these two?

function story_view($node, $main = 0){}

// This above was giving me erroneous output for my node.

cel4145’s picture

That's pretty cool. I use Drupal for supporting the college writing classes I teach and can see how a quiz module would be important for those of us in education. Great stuff!