A better way to do this using Custom Pagers module is detailed in the Image module documentation: http://drupal.org/node/709462
description
The following adds a custom next_prev
function to your theme template.php file that allows you to insert NEXT | PREVIOUS type links in your layout.tpl.php files. Where layout might be node.tpl.php, node-image.tpl.php etc.
In the illustrative example snippet below, a simple NEXT | PREVIOUS link is inserted into a custom node-image.tpl.php file linking to the next and previous image within that gallery (taxonomy term).
step 1 of 2
Add the custom next_prev
function to your template.php file.
- In a text editor like notepad.exe or equivalent, create/edit a template.php file and paste the following snippet
- Save your new/edited template.php file and upload it to your active theme folder
function next_prev for Drupal 5
<?php
function next_prev($current_nid, $type, $button_type, $label, $class) {
$tid = db_result(db_query(db_rewrite_sql("SELECT tid FROM {term_node} WHERE nid = $current_nid;")));
if (empty($tid)){ //validate that the image 'does' have a tid
return '';
}
switch ($button_type) {
case 'next':
$sort= 'ASC';
$case = '> ';