I'm creatng my own node-flexinode-n.tpl.php template to display page and teaser views for flexinode nodes as described here: http://drupal.org/node/45485

I'm successful at creating the page and teaser views. However, I can't seem to get the number of reads (page views count) for the flexinode nodes.

This code does not retrieve the '%count" reads as it should:

	$statistics = statistics_get($node->nid);
	if ($statistics) {
  		$reads = 0;
  	} else {
  		$reads = $statistics['totalcount'];
	}

Can someone help me out here? Thanks.

-ron

Comments

SomebodySysop’s picture

My logic was backwards. Corrected code works as it should:

<code>
	$statistics = statistics_get($node->nid);
	if ($statistics) {
  		$reads = $statistics['totalcount'];
  	} else {
  		$reads = 0;
	}