Print Album Menu: Context issue

bic Member, Translator
Hi all!
Using print_album_menu plugin I've noticed a strange behavior:
If you jump from a dynamic album to a static one, and then you choose an image included in the dynamic album too, ZP goes in ZP_SEARCH_LINKED context while showing the image.
Then you'll browse a wrong album (with the dynamic album name in the Breadcrumb instead of the static one too).

Latest version of zenphoto (Nightly Build 20/04/2009) with zenpage default theme.

Comments

  • bic Member, Translator
    edit:
    I have the same issue whenever i switch between search results and a static album directly (using album menu) without passing across gallery index.
    It appends that the cookie `zenphoto_image_search_params` is still present in such a case.
    May be this could cause the problem?
    If the first image i choose in the static albun in not in the search results, I can browse the album till I find an image that is part of the results. Then the context switches to ZP_SEARCH_LINKED and I fall browsing the results...
  • I think I see what is happening here. Try tonight's build [3839] and see if that fixes it.
  • bic Member, Translator
    Ok, installed the 3839 SVN zp-core (but 3836 is reported in admin panel).

    It solved my issue, and works ok with dynamic albums but, after a normal search, the image.php page in not anymore in ZP_SEARCH_LINKED context, infact `get_context()=7` , so that you can't browse the resulting image pages

    Another little issue, already present in previous build, is that if while browsing the image.php pages generated by a dynamic album you click a link in the Breadcrumb and then go back in browser the context is loosed again and you fall in a static album. I suppose that nothing can be done about it.
  • bic Member, Translator
    I made further investigations.
    You added this line in functions.php
    `line 1220 zp_setcookie("zenphoto_image_search_params", "", time()-368000, $cookiepath);`
    to delete the search cookie.
    This way the cookie is deleted if not in ZP_SEARCH_LINKED context.
    The problem is that when search result are displayed as thumbs the context is ZP_SEARCH if I'm not wrong.
    I've put the deletion under the condition: `if (in_context(ZP_ALBUM |ZP_IMAGE))` so that the cookie is not deleted when search results are displayed.
    It seems to work ATM, I don't know if it's clean, I'm absolute beginner.
  • That code seems to make no difference to me. The problem I am seeing is that the image album name is not in the breadcrumbs. That, I believe, is a different issue.
  • bic Member, Translator
    That's strange, i do have the image name in the breadcrumbs, and now it works as it should.
    My 1220 line is: `if (in_context(ZP_ALBUM |ZP_IMAGE)){zp_setcookie("zenphoto_image_search_params", "", time()-368000, $cookiepath);}`

    if i remove the ZP_ALBUM |ZP_IMAGE condition I can't browse the image search results
  • Can you walk me through just what is not working when you say you can't browse the image search resluts? I am not seeing any problems. In addition. If we get to the place where the cookie is reset we are not in a search context and the search engine is set to NULL, so there should be nothing to be remembered.
  • bic Member, Translator
    > search engine is set to NULL, so there should be nothing to be remembered.

    Yes, may be that's why it needs the cookie to browse the searched images pages.

    >Can you walk me through just what is not working when you say you can't browse the image search resluts?

    This is a search results page:
    Search Results

    Now after your 1220 line for cookie removal if you click on a thumb, let's say the first one:
    Browse 1

    Before adding the new 1220 line or whit the ZP_ALBUM |ZP_IMAGE condition added:
    Browse 2

    In the pictures I posted you can only see the difference in the breadcrumb (and in the prev button present only in the first case) but if you continue browsing using the next button you'll see that in the first case you are in the Portfolio album (18 images), in the second case you are browsing the search results (4 images).
  • This seems to happen only on the zenphoto default theme. I will look into it and see what is going on. (Thanks for the pictures!)
  • Found the problem--a bug in the default and zenpage-default theme. Fixed in [3850] or you can delete the line in search.php that loads the prototype.js script (It does not exist!)
  • bic Member, Translator
    Great, thanks!
    This world of coding is a real a mistery!!!
  • bic Member, Translator
    I resume this topic to have your attention on another problem, probably due to the same cookie:
    `zenphoto_image_search_params`
    It appens with zenpage default theme.
    When in Gallery archive, if you follow a month link (like 2009 > April) all the dynamic albums displayed by Print Album Menu show the same number of image beside the name of each album, that is the number given by the date's search results.
  • So, have you installed the nightly build?

    The original problem was caused by "silent" 404 errors. The fix in the nightly build is to avoid clearing the cookie under that circumstance.
  • bic Member, Translator
    Yes, latest nightly build has the same problem.
    I didn't notice it before but this behavior also affects the "News archive" month links. In this case the number displayed beside names of dynamic album is zero (nothing displayed actually).
    So, is there something wrong everytime we have a DATE in the search cookie?
  • bic Member, Translator
    Well, I realized that there is not a cookie involved in the second case (NEWS Archive month link). The only thing it has in common with the former case (GALLERY Archive month link)is the word DATE in the REQUEST_URI...
  • bic Member, Translator
    print_album_menu line 137:
    `topalbum = new Album($_zp_gallery,$album,true);`
    For one of those misterious reasons that make this world of software so fascinating, when `&date` is in QUERY_STRING `topalbum` is populated with the images (if any) present in the search for date results. This happens only if `$album` is a dynamic folder.
    Try it to believe!
  • Well, date is a valid search option, so that might explain things. Where did the `&date` come from?
  • bic Member, Translator
    In the query string:
    ../index.php?p=search&date=2009-04
    or
    ../index.php?p=news&date=2009-05
  • Yes.

    Dynamic albums use the search engine. Archive pages use the search engine. There is only one search remembered.
  • bic Member, Translator
    This is not the point. In whatever search situation, other than date, print_album_menu works correctly, displayng ther right number of picures also for dynamic albums.
    Infact it uses a new album object to do it, as seen a few posts above.
    But if date is involved in the serch, the new album object is populated with wrong images!

    This, of course, is not a problem of the plug in, it happens whenever you try to build a new album object in a search for date context.
  • acrylian Administrator, Developer
    `../index.php?p=news&date=2009-05` is a news article archive link and that actually does not use the search engine currently. That might confuse the search engine somehow and was never noticed before maybe.
  • bic Member, Translator
    Infact, I relized that. The two situation where we have this problem are different but the "confusion" they create is the same. The only thing they have in common to my beginner eyes is the word "search" in the query string, but probably there is a context issue. I have skipped this problem hiding total image number in print album menu, anyway it could be usefull to resolve this little bug, I suppose.

    While we are here I also suggest to add this two lines to the print_album_menu function after line 153 (latest nigthly):
    `
    } else if(in_context(ZP_ALBUM) && in_context(ZP_SEARCH_LINKED) && $_zp_current_search->dynalbumname == $topalbum->name) {
    $link = "".$topalbum->getTitle().$count;
    `
    after declaring $_zp_current_search as global.

    This enhances the context sensitive behavior of the menu, extending it to dynamic albums too.
Sign In or Register to comment.