nodeapi with op = load being ran multiple times I am currently creating a custom module. I am trying to alter a node's body before it is displayed to the user. So I used hook_nodeapi();

I did something like

function hook_nodeapi(&amp;$node, $op, $a3 = NULL, $a4 = NULL){
  if($node-&gt;type=='page' &amp;&amp; $op =='load'){
    dsm($op);
    //the rest of my code goes here
  }
}


When ran, this displays  8 "load"s when viewing a page.

Why is that? I think it is because of the other modules I have that may be calling node_load, but I am not really sure.

Can anyone shed a light here? And how do I make it possible so that my code is not ran multiple times (in this case, 8 times)?

Thanks.

UPDATE:
I forgot to mention a couple of key things.

I am using the revisioning module. The page I am viewing is an unpublished revision. I tried this:

function hook_nodeapi(&amp;$node, $op, $a3 = NULL, $a4 = NULL){
  if($node-&gt;type=='page' &amp;&amp; $op =='load'){
    dsm($node-&gt;nid);
   dsm($node-&gt;vid);
   //the rest of my code goes here
  }
}


I get 8 similar nids, and then 7 similar vids (the unpublished revision), and then 1 vid (the currently published revision)

916
4544

916
3740

916
4544

916
4544

.. and so on
You need to use view $op

function hook_nodeapi(&amp;$node, $op, $teaser, $page){
  if($node-&gt;type=='page' &amp;&amp; $op =='view'){
    if ($teaser) {
      drupal_set_message("I am viewing page content type teaser");
      //the rest of my code goes here
    }
    if ($page) {
      drupal_set_message("I am viewing page content type full node view");
      //the rest of my code goes here
    }

  }
}



  view: The node content is being assembled before rendering. The
  module may add elements $node->content prior to rendering. This hook
  will be called after hook_view(). The format of $node->content is the
  same as used by Forms API.


And you need to check for teaser view or full node view using $a3 or $a4 respectively.

Check how many nodes you are rendering in a page. For example if you are in a view where view is displaying 10 nodes then 10 times message will appear.

Hope it answers your issue !