forum.coppermine-gallery.net

No Support => Feature requests => Topic started by: Lombi on September 27, 2004, 06:29:52 pm

Title: [req] Permanent $prev and $next functions
Post by: Lombi on September 27, 2004, 06:29:52 pm
The previous and next functions in displayimage.php is probably the simplest thing i saw in coppemine as of yet :)

This is what I'm talking about:
Code: [Select]
function html_img_nav_menu()
{
    global $CONFIG, $HTTP_SERVER_VARS, $HTTP_GET_VARS, $CURRENT_PIC_DATA, $PHP_SELF;
    global $album, $cat, $pos, $pic_count, $lang_img_nav_bar, $lang_text_dir, $template_img_navbar;

    $cat_link = is_numeric($album) ? '' : '&cat=' . $cat;

    $human_pos = $pos + 1;
    $page = ceil(($pos + 1) / ($CONFIG['thumbrows'] * $CONFIG['thumbcols']));
    $pid = $CURRENT_PIC_DATA['pid'];

    if ($pos > 0) {
        $prev = $pos - 1;
        $prev_tgt = "$PHP_SELF?album=$album$cat_link&pos=$prev";
        $prev_title = $lang_img_nav_bar['prev_title'];
    } else {
        $prev_tgt = "javascript:;";
        $prev_title = "";
    }
    if ($pos < ($pic_count -1)) {
        $next = $pos + 1;
        $next_tgt = "$PHP_SELF?album=$album$cat_link&pos=$next";
        $next_title = $lang_img_nav_bar['next_title'];
    } else {
        $next_tgt = "javascript:;";
        $next_title = "";
    }

The function just adds and subtracts a number from the picture "default positioning" and that's kinda it.
As now an amazing mod_rewrite hack and a constant pid hack are available I was wondering if anyone knows how to rewrite this function to look at the album and do the same result (linking to the same images and in the same order), only this time with PIDs...

I am trying to accomplish something similar myself but I'm aware that here are some amazingly talented programmers who can do the job much better/faster than me :P

If you're looking for a challenge than this might be an interesting goal ;D
Title: Re: [req] Permanent $prev and $next functions
Post by: Tranz on September 27, 2004, 06:33:16 pm
Moving this to requests board.