ZenphotoCMS Forum
Print Album Menu: Context issue - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: Plugins (https://forum.zenphoto.org/forum-6.html)
+--- Thread: Print Album Menu: Context issue (/thread-5108.html)

Pages: 1 2


Print Album Menu: Context issue - bic - 28-04-2009

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.




Print Album Menu: Context issue - bic - 28-04-2009

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...




Print Album Menu: Context issue - sbillard - 28-04-2009

I think I see what is happening here. Try tonight's build [3839] and see if that fixes it.




Print Album Menu: Context issue - bic - 28-04-2009

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.




Print Album Menu: Context issue - bic - 28-04-2009

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.




Print Album Menu: Context issue - sbillard - 29-04-2009

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.




Print Album Menu: Context issue - bic - 29-04-2009

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




Print Album Menu: Context issue - sbillard - 29-04-2009

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.




Print Album Menu: Context issue - bic - 30-04-2009

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).




Print Album Menu: Context issue - sbillard - 30-04-2009

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!)




Print Album Menu: Context issue - sbillard - 30-04-2009

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!)




Print Album Menu: Context issue - bic - 01-05-2009

Great, thanks!
This world of coding is a real a mistery!!!




Print Album Menu: Context issue - bic - 15-05-2009

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.




Print Album Menu: Context issue - sbillard - 15-05-2009

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.




Print Album Menu: Context issue - bic - 16-05-2009

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?




Print Album Menu: Context issue - bic - 16-05-2009

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...




Print Album Menu: Context issue - bic - 16-05-2009

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!




Print Album Menu: Context issue - sbillard - 16-05-2009

Well, date is a valid search option, so that might explain things. Where did the &date come from?




Print Album Menu: Context issue - bic - 16-05-2009

In the query string:
../index.php?p=search&date=2009-04
or
../index.php?p=news&date=2009-05




Print Album Menu: Context issue - sbillard - 16-05-2009

Yes.

Dynamic albums use the search engine. Archive pages use the search engine. There is only one search remembered.