Navigation from Image page after sort on album page

Hello,

I have 3 sort options on my album page. When the sort is performed and an images is selected the next image and previous image buttons do not go to the next and previous images based on the sort performed. Also, the album link in the breadcrumb does not return to the page where the image is after the sort (I am fine just making the link always return to page 1 with no sort). I am having trouble finding where I can strip the page portion out of the Album title portion of the breadcrumb. I have no idea how to fix the first problem. Any help is appreciated, thanks.

Gallery is located here: http://76.12.89.207/ffgallery/

Comments

  • acrylian Administrator, Developer
    How do you set the sortorder? Best you post the code.
  • Right...

    if(ISSET($_GET['imgsort'])) {
    if ($_GET['imgsort'] == "views") {
    $imgsortby = "hitcounter";
    $imgorder = "DESC";
    }
    if ($_GET['imgsort'] == "rating") {
    $imgsortby = "total_value";
    $imgorder = "DESC";
    }
    if ($_GET['imgsort'] == "lastcomment") {
    $imgsortby = "custom_data";
    $imgorder = "DESC";
    }
    }

    while (next_image(false, $firstPageImages, $imgsortby, $imgorder)):
  • acrylian Administrator, Developer
    This sets only the sort order for the next_image loop temporarily. If you click on the image Zenphoto that setting is lost. Try using the function `setOption()` to set the image order permanently. I think that is `'image_sorttype`but please check the real db options table, I write this from memory right now.
  • Cool, we are getting closer. My code looks like this now...

    if(ISSET($_GET['imgsort'])) {
    if ($_GET['imgsort'] == "views") {
    $imgsortby = "hitcounter";
    $imgorder = "DESC";
    setOption('image_sorttype','hitcounter',FALSE);
    setOption('image_sortdirection',$imgorder,FALSE);
    }
    else if ($_GET['imgsort'] == "rating") {
    $imgsortby = "total_value";
    $imgorder = "DESC";
    setOption('image_sorttype','total_value',FALSE);
    setOption('image_sortdirection',$imgorder,FALSE);
    }
    else if ($_GET['imgsort'] == "lastcomment") {
    $imgsortby = "custom_data";
    $imgorder = "DESC";
    setOption('image_sorttype','custom_data',FALSE);
    setOption('image_sortdirection',$imgorder,FALSE);
    }
    }

    The problem is if I set the persistent parameter to false, it does not work at all and I do not want the option change to be permenant, especially for all users. If I leave the persistent parameter blank (TRUE), it has the desired outcome except for it being permenant.
  • acrylian Administrator, Developer
    I see. If you set that to "false" it's actually the same as before...:-) You need of course to transfer this setting to the image page, the easiest would probably be to use the url query again. So you need the same check on image.php again.
  • Ahh... I'm starting to catch on, working now. Thanks!
Sign In or Register to comment.