Drupal 7 Pager for Node Gallery


Using Drupal 7's views pager to implement a... by kiwipion

Introduction

In the Node Gallery tutorial we created a teaser view to highlight the galleries images while viewing the node image. That teaser view was not a pager so this tutorial will be implementing a pager for the node gallery.

Prerequisites

Node Gallery tutorial

Material Covered

Using Views Relationships to redirect the link to the Node Gallery and setting it up in Views REWRITE RESULTS.

Steps

Grab a copy of the node gallery feature from here and install it or follow the Node Gallery tutorial

Now we will change the Album teaser view for the Node Gallery here.

so the Node Gallery thumbnails point to the Node Galleries instead of the Node Gallery images.

Go to the Single Image display in the Album Teaser view. We will redirect the image link to the Node Gallery instead of the image itself.

To do this we need to create a relationship with the node gallery using the node references url widget that you setup in the content type Node Image.

Next add a Content:Nid field and enable the relationship. Enable the "Exclude from display" box so the nid values do not display above the images.

Also you may need to rearrange the field so that it is above the image field.

Edit the image field and make sure the 'link image to' widget is set to 'nothing'. Then go into the rewrite results tab and select "output this field as link". Here we are redirecting the link path to the Node Gallery. We will use the Content:Nid from the replacement patterns as such

And inserting it into the link path as such

Also the "link to image' in Formatter will need to be set to nothing or else it will override the "Rewrite Results" settings.

Now go into the Node Gallery View and change the image field formatter to Colorbox and the gallery grouping to per page instead of per post.

That's it, you should now have the pager enabled for your Node Gallery.

Comments

Submitted by shirlin (not verified) on

It seems kind of weird that when I do "rewrite results" for add_node_image field, I can't find [nid] under REPLACEMENT PATTERNS. As a result, the link path node/[nid] redirect to a page not found. Does this happen to anyone else?

Pages

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Recent Tweets

  • New post: Posting location co-ordinates to a drupal service - Part 2 http://t.co/MQhlVKBNKC 2 months 2 days ago
  • New post: Posting location co-ordinates to a drupal service - Part 1 http://t.co/2xlYgqFaJ0 2 months 3 days ago
  • New post: Connecting a drupal service with a mobile application - Part 2 http://t.co/01cFtAunDs 2 months 3 days ago
  • New post: Using drupal services to connect to mobile applications - Part 1 http://t.co/VEURftHCef 2 months 3 days ago
  • New post: Creating Drupal 7 video gallery http://t.co/HvpKU7uT 4 months 1 week ago