1

Simple previous / next navigation by node title

http://2bits.com

We have posted before on how to display previous/next thumbnails for image nodes. We also have a module that is basically a Previous/Next API for high volume / high performance sites.
But sometimes you need a simpler solution for regular nodes, just using the node title and a link to it. This article explains how to achieve that for Drupal 6 in one simple function and a few changes to one .tpl.php file.
First, we start off with the code that does the heavy lifting.
In your theme's template.php add the first function from the attached file. By default it provides paging for blog posts only. You can change that to another type of node (or multiple types).
The code is fast, since it uses the nid as an index. So if you use this on large sites, it would not slow them down.
Then in your node.tpl.php, or node-TYPE.tpl.php, add the second snippet in the attached file. This provides calls to the next/previous node with hyperlinked titles.
For the styling, add the CSS from last snippet in the attached file.

read more

Read »
Created by twobits 2 years 32 weeks ago – Made popular 2 years 32 weeks ago
Category: Optimization   Tags:

PSD to Drupal Theme

Drupal Development

Module Development

Get an Estimate

Tags for Simple previous / next navigation by node title

Recent comments