Hello,
i need to save in database the number of times a node is bieng viewed by users of a specific content type. I am displaying that node through panels. iam implemeting hook_nodeapi but iam not geeting in the $op = 'view' so that i can increment in database the counter related to that node. iam i follwoing the rite approach please help

Comments

j2r’s picture

there is statistics module to count the number of view of the node but it will not work with panel
here is the link of the same issue you may find help overthere

http://drupal.org/node/606384

prabeen.giri’s picture

If u are going to use your custom script then you can use 'nodeapi' hook on your custom module to achieve this;

function my_module_nodepi(&$node, $op, $a3 = NULL, $a4 = NULL)  { 
    switch($op) {
        case "view":
	    if ($node->type =="my_content_type") {
	       db_query()// to get the current hits
               db_query()// to update the hits
            } 
	break;
     } 
} 

Hope this helps :)

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.