Hi All

I've run across a problem with a gallery which is currently here: http://web1.jesus.ox.ac.uk/about/gallery

The images on the first page "expand" perfectly. On the second page, however, the images "expand" to their corresponding images on the first page (so, for example, the first image on the second page expands to become the first image on the first page).

I'm using Lightbox triggers to display the captions, which might be the problem (is the wrong argument being passed to Lightbox?) but the HTML looks right. Could anyone enlighten me?

blue skies

Tom

Comments

Issue tags:+lightbox2, +repeat, +tokens, +pager, +bugs

Hey i have the same exact problem in this web amarilysfloreria.com, the first page in the views expand ok , but if we go to the second page, the data expand images and info like the position in the first page. I think this have something to do with the tokens being cached. Im trying to put this code in the header of the view token_get_values('global', NULL, TRUE);, but i cant find where to configure the Php filter. Any Ideas

Project:Views Gallery» Lightbox2
Version:6.x-1.2» 6.x-1.x-dev
Assigned:Unassigned» jeeba
Category:support» bug
Status:Active» Needs review
Issue tags:+bug, +paging, +fixed

Found the answer after 4 hours of debuging, the problem is in lightbox2. The problem is that Lightbox2 is not creating the adecuate path to your view when it use paging. To correct the error go to the file lightbox2_handler_field_lightbox2.inc , and in the line 124 you should see something like this:

<?php
    
// We don't actually use the link, but we need it there for lightbox to function.
     
if (empty($link)) {
       
// Get the path name.
       
$path = isset($_GET['q']) ? $_GET['q'] : '<front>';
       
$link = url($path, array('absolute' => TRUE));
      }
?>

Change that like this:

<?php
    
// We don't actually use the link, but we need it there for lightbox to function.
     
if (empty($link)) {
       
// Get the path name.
       
$path = isset($_GET['q']) ? $_GET['q'] : '<front>';
       
//Created By Carlos
       
if(isset($_GET['page'])){
         
$path = $path .'?page='.$_GET['page'];
        }
       
$link = url($path, array('absolute' => TRUE));
      }
?>

If GET has a page variable then add it to the path, and problem solved,I dont know if this is going to give me some headache in the future but so far it works like wonders.

Status:Needs review» Postponed (maintainer needs more info)
Issue tags:-bug, -lightbox2, -repeat, -tokens, -pager, -paging, -fixed, -bugs

I don't fully understand the problem here. I've created a simple image gallery view on my sandbox, with paging enabled. Each of the images is a different size, and the lightbox resizes correctly regardless of which page of the view I'm on.

@stella,

The problem has nothing to do with image size. The problem is that if, for example, you have a large gallery (100+ images) using the Lightbox Trigger technique (so that you can display a caption), and in the View you assign a pager (so that only 20 images display per page), if/when you click on a thumbnail on page-2, the lightbox displays the wrong image because it is counting from page-1. I have been struggling with this thinking it was related to Grouping (as per http://drupal.org/node/770718) but it's not actually a grouping issue, it's a pagination issue.

@jeeba

I LOVE YOU!!! THANK YOU!!!!!!!!!!!

Your hack fixes both the pagination and the grouping issue as described in http://drupal.org/node/770718.

Hale-frikken-lujah!!!

I am using lightbox2 version 6.x-1.9
I can not find the file lightbox2_handler_field_lightbox2.inc

Could somebody point me towards it?

Thanks,
Shawn

Status:Postponed (maintainer needs more info)» Active

@shawngoldw: I think you have to use the 6.x-dev version for the file (and the trigger-functionality) to be there.

But I'd like to add that the problem described in this issue isn't just when using pager-functionality but also when using other filters. I suspect it's because the handler doesn't check for other values in the $_GET-global than the 'q'-key. Jeeba's solution solves the problem by extracting the value of the page-key in the $_GET-global.
Following code seems to solve all problems (pagination as well as filters).

<?php
     
if (empty($link)) {
        
$path = "";
       
$param = $_GET;
        if (!empty(
$param)){
    foreach (
$param as $keys=>$value)
                   {
                  
$path .= "&".$keys."=".urlencode($value);
                   }
        }else{
       
$path = '<front>';
        }
       
$link = url($path, array('absolute' => TRUE));
      }
?>

I'm not entirely sure this works in all situation (or is Drupal-proofed), so more testing by other people would be great!

It would be awesome if this issue could be resolved in an upcoming release, since the trigger-field is an amazing tool.

jeeba's code seemed to have worked for me. thanks!

Yes, jeeba's code worked for me too. Will this be added permanently to the next lightbox version?

Anyone have any luck getting this to work with exposed date filters? Jeeba's code works for the pagers, but sjbwille's code is giving me a problem since the exposed filter i'm dealing with is a date cck field, and so the $value is an array itself. I'm trying to figure out how to pass ['date_filter_1']['value'] through the url correctly with no luck so far...

Just as a followup, i found a working solution in my particular case, that works with both page and a specific filter (in lightbox2_handler_field_lightbox2.inc on line 124). My exposed filter was a date field, which is an array in itself. In this case i was just passing the year in but you could easily add the month/day/time values to this as well:

// We don't actually use the link, but we need it there for lightbox to function.
      if (empty($link)) {
        // Get the path name.
        $path = isset($_GET['q']) ? $_GET['q'] : '<front>';
        //Created By Carlos, modified by Tim
        if(isset($_GET['date_filter_1'])){
        $query = 'date_filter_1[value][year]='.$_GET['date_filter_1']['value']['year'];
        if(isset($_GET['page'])){
          $query = $query .'&page='.$_GET['page'];
        }
        }elseif(isset($_GET['page'])){
          $query = $query .'page='.$_GET['page'];
        }
        $link = url($path, array('query' => $query,'absolute' => TRUE));
      }

Also it's probably best practice to use the 'query' attribute in the url command, since with jeeba's original code you couldn't pass more than one argument through. This should help someone in a pinch, but ultimately it would be best to be able to write something that would work for any exposed filter, regardless of how deep the array goes. Thanks for pointing me in the right direction!

After more than a year in the queue, this issue is still present.

A use case where it pops up is when using lightbox in a view. Create a view that displays 4 images with a pager. Give the view a pool of > 4 images to display, then when viewing the output, hover over any image greater than image number 4. You will notice that the link is '/view/name #lightbox-popup-5', and that the wrong image will pop open when clicked. When you apply the fix suggested by jeeba, the url seen in the browser is '/view/name?page=1 #lightbox-popup-5' and displays the correct image.

Wooow, this seems like a pretty big issue for anyone with more than one page of results using this... what a help this has been! post http://drupal.org/node/770718#comment-3050902 fixed this issue for me as well. thanks!

Thanks jeeba, worked perfectly. You saved me a lot of time and headache.
Hopefully this is fixed in D7.

Wow! #2 solved the issue I had with trigger and html content too!
# 1305462: Lightbox trigger for html content works only on the first views page

Please change the issue's title so that it contains the word "trigger" too. It seems this is an issue with trigger and pager.

Hi,

I've just got the right information to display at last using #7 ... #2 didn't work for me... My view has 4 exposed filters...

Now i'm getting:

warning: urlencode() expects parameter 1 to be string, array given in \sites\all\modules\lightbox2\lightbox2_handler_field_lightbox2.inc on line 134.

I'd sincerely appreciate any help... you can see it here: http://agency.onlinebusinessbuilders.co.uk/search-entertainment-acts

Guy

Just noticed this morning that using (http://drupal.org/node/770718#comment-3392314) actually breaks things on the taxonomy pages... Doh! Nothing is displayed in the pop up...

Viewable here: http://agency.onlinebusinessbuilders.co.uk/taxonomy/term/4,24

Guy

Problem still exists - the patch in #2 solved it for me.