Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorkegster
    • CommentTimeOct 4th 2010 edited
     
    Since I can't figure out how to add to the TRAC, I'd like to share what modifications I've added to my plogger in order to fix a bug I've found and to help the user ability.

    First, on many browsers, the rows seem flipped. For instance, if I have 6 photos in an album and I have 5 photos in a row, the 6th item by itself will actually be the first image for some reason. While wanting to fix this, I also wanted to add a NEXT button to the last image that would bring you back to the first image. Then I thought, well if I do this successfully and add a previous link to the first image that brought you to the last image, then not only would I accomplish what I wanted, but also I would squash the bug I have found.

    What I did was add a couple functions.

    function plogger_get_first_picture_url() {
    $image_list = $GLOBALS['image_list'];
    $row = $GLOBALS['current_picture'];
    $current_picture = array_search($row['id'], $image_list);
    $first_link = '';
    if ($current_picture > 0) {
    $first_link = generate_url('picture', $image_list[0]);
    }
    return $first_link;
    }


    And

    function plogger_get_last_picture_url() {
    $image_list = $GLOBALS['image_list'];
    $total_items = count($image_list);
    $last_link = generate_url('picture', $image_list[$total_items-1]);
    return $last_link;
    }


    Then I modified the plogger_get_prev_picture_link() and plogger_get_next_picture_link() to as follows:

    function plogger_get_prev_picture_link() {
    global $config;
    $prev_url = plogger_get_prev_picture_url();
    if ($prev_url)
    if ($config['embedded'] == 0) {
    $prev_link = '<a id="prev-button" accesskey="," href="'.$prev_url.'">&laquo; '.plog_tr('Previous').'</a>';
    } else {
    $prev_link = '<a id="prev-button" accesskey="," href="'.$prev_url.'">&laquo; '.plog_tr('Previous').'</a>';
    } else
    $prev_link = '<a id="prev-button" accesskey="," href="'.plogger_get_last_picture_url().'">&laquo; '.plog_tr('Previous').'</a>';
    return $prev_link;
    }


    function plogger_get_next_picture_link() {
    global $config;
    $next_url = plogger_get_next_picture_url();
    $first_url = plogger_get_first_picture_url();
    if ($next_url)
    if ($config['embedded'] == 0) {
    $next_link = '<a id="next-button" accesskey="." href="'.$next_url.'">'.plog_tr('Next').' &raquo;</a>';
    } else {
    $next_link = '<a id="next-button" accesskey="." href="'.$next_url.'">'.plog_tr('Next').' &raquo;</a>';
    } else
    $next_link = '<a id="next-button" accesskey="." href="'.$first_url.'">'.plog_tr('Next').' &raquo;</a>';
    return $next_link;
    }


    I changed the last else clause from blank to that. Also, I realized that after doing this there is probably a more simpler way to do it, however the way I have it works flawlessly. Why fix what's not broken?

    I hope this helps anyone out. This is a bug fix to me because this actually resolves the issue with the out-of-order / out-of-place image by creating a continuous loop of links so you never are technically at the first or the last.

    This is also viewed as not a bug fix because it pretty much just masks the issue. If you do not want a continuous loop of links (ie no stop or end, prev and next links go on forever), then this bug will surely be eating you away.

    FYI. This bug is actually not just on my plogger. It's on various 'sample ploggers' all over the place. It is not unique to mine, so do not attempt to think my modifications have caused this. This is an issue and should be looked into =D. Remember. It's not a browser version or compatibility. Some browsers just show it. For instance, even Firefox will.
    Thankful People: floriske.nl
  1.  
    Thx a lot for this one! Just what I was looking for.