I see this on many newspaper sites and wanted to create this functionality for OpenPublish. On each article is a link to next and previous articles. This is a great devise to get people to stay on the website and read more. If I could get each visitor to click on on more article it would be a great for revenue by increasing page views by 20%.
There are three ways to do this. The first is the basic way http://drupal.org/node/37767 . I am told that this method doesn't scale well, is very inefficient and heavy because of the database query overhead. The second is Custom Pages http://drupal.org/project/custom_pagers which I assume would work just fine, but I really haven't looked at it too deeply. And, lastly the Prev / Next API http://drupal.org/project/prev_next .
I went ahead and used the Prev / Next api which basically just makes a database table of a nid and then the previous nid and the next nid on the same table row. It populates this table 100 at a time through cron runs. That makes a lot of sense to me. The module pulls the previous nid or next nid from the database via a function call that takes the current nid and an operation of 'prev' or 'next'.
I just created a view with node:nid as an argument. Selected Provide default argument radio button. Default argument type: PHP code. PHP argument code --
$node = node_load(arg(1));
$nid = prev_next_nid($node->nid, 'next');
return $nid;It seems to be working in preliminary tests so far. It does allow me to build a simple view with thumbnail and teaser which I figure I can just put in a div somehow in the node.tpl file somehow.
Has anybody seen the next pager on nyt.com? Wish I could throw this into some JavaScript like that.
Comments
removed
posted in the wrong place