[Plugin: NextGEN Gallery] Improvements to Image Browser (FIRST/LAST photo buttons)
-
I find that, in addition to the PREV and NEXT buttons available on the ImageBrowser view, FIRST and LAST buttons are also quite helpful.
Here are the code changes I made to add these buttons:
First, in nggfunctions.php, add the following:
Line 607 is:
$next_pid = ( $key < ($total-1) ) ? $picarray[$key+1] : reset($picarray) ;
After this line, add:$first_pid = reset($picarray); $last_pid = end($picarray);
Line 623 is:
$picture->next_pid = $next_pid;
After this line, add:$picture->first_image_link = $nggRewrite->get_permalink(array ('pid' => $first_pid)); $picture->first_pid = $first_pid; $picture->last_image_link = $nggRewrite->get_permalink(array ('pid' => $last_pid)); $picture->last_pid = $last_pid;
Then, in view\imagebrowser.php:
Replace these lines:
<div class="back"> <a class="ngg-browser-prev" id="ngg-prev-<?php echo $image->previous_pid ?>" href="<?php echo $image->previous_image_link ?>">◄ <?php _e('Back', 'nggallery') ?></a> </div> <div class="next"> <a class="ngg-browser-next" id="ngg-next-<?php echo $image->next_pid ?>" href="<?php echo $image->next_image_link ?>"><?php _e('Next', 'nggallery') ?> ►</a> </div> <div class="counter"><?php _e('Picture', 'nggallery') ?> <?php echo $image->number ?> <?php _e('of', 'nggallery')?> <?php echo $image->total ?></div> <div class="ngg-imagebrowser-desc"><p><?php echo $image->description ?></p></div>
With these lines:
<div class="ngg-imagebrowser-desc"><p><?php echo $image->description ?></p></div> <ul> <li class="ngg-imagebrowser-nav-first"> <a class="ngg-browser-prev" id="ngg-last-<?php echo $image->first_pid ?>" href="<?php echo $image->first_image_link ?>"><?php _e('First', 'nggallery') ?></a> </li> <li class="ngg-imagebrowser-nav-prev"> <a class="ngg-browser-prev" id="ngg-prev-<?php echo $image->previous_pid ?>" href="<?php echo $image->previous_image_link ?>"><?php _e('Prev', 'nggallery') ?></a> </li> <li class="ngg-imagebrowser-nav-jump"> <?php _e('Picture', 'nggallery') ?> <?php echo $image->number ?> <?php _e('of', 'nggallery')?> <?php echo $image->total ?> </li> <li class="ngg-imagebrowser-nav-last"> <a class="ngg-browser-next" id="ngg-last-<?php echo $image->last_pid ?>" href="<?php echo $image->last_image_link ?>"><?php _e('Last', 'nggallery') ?></a> </li> <li class="ngg-imagebrowser-nav-next"> <a class="ngg-browser-next" id="ngg-next-<?php echo $image->next_pid ?>" href="<?php echo $image->next_image_link ?>"><?php _e('Next', 'nggallery') ?></a> </li> </ul>
For reference, here is a working example of the above ImageBrowser changes.
Hope this is helpful to some.
Should I add this as a ticket to the GoogleCode site for NGG?
- The topic ‘[Plugin: NextGEN Gallery] Improvements to Image Browser (FIRST/LAST photo buttons)’ is closed to new replies.