Member
Member
Rousset   22-10-2010, 22:40
#1

Hi,

When I create a list of tags for the album level, the search runs all over the entire gallery. Is there a way to get the search to run only inside the album for which they have been created?
It would be logic, and very useful too.

Thank you.

Version de Zenphoto 1.3.1.2 [5831] (Version officielle)


Current gallery theme: zpGalleriffic


PHP version: 5.2.14


Graphics support: PHP Imagick library 3.0.1RC2


ImageMagick 6.6.0-2 2010-07-13 Q16 http://www.imagemagick.org

Member
Member
sbillard   23-10-2010, 00:59
#2

As is often the case, a simple review of the function descriptions involved can answer a lot of questions: http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintSearchForm

Member
Member
jdaverth   08-11-2010, 00:09
#3

@sbillard, I think you misunderstood the question. I am also dealing with this problem. I have sorted it somewhat with the following modification to tags_from_album.php.

Around line 174, I added $album = getAllSubAlbumIDs();
and then modified the next line to include a call to the first cell in the array:

echo "[*]".$tname.$counter."".$separator." \n";
It's working a peach for subalbums, but the problem is that if I am in a main album, there technically aren't any photos there (as they all reside in the subalbums), so while the tags show up perfectly, the resulting searches (by which I mean clicking on the tag) turn up empty even though there are plenty of hits to be had in the subalbums of that parent.

Would love to see someone improve upon this - it's giving me a headache!

Member
Member
sbillard   08-11-2010, 03:29
#4

jadaverth: I really do not see how what you have descirbed relates to searching. Maybe I am just dense. I suppose that if you search an empty album it really should not return any results.

If you want to search more then one album, then by all means, do so. You can supply as many albums as you want in the search list.

Member
Member
jdaverth   08-11-2010, 09:19
#5

echo "[*]".$tname.$counter."
Since im new on the forum it is not letteing me preview my posts, so I am only now seeing that there is a truncation on my code. It should be
echo "".$tname.$counter."".$separator." \n";
(in case that also doesn't post, I am passing $album[0] as the last parameter to getSearchURL.

As you say, it is indeed correct to return empty results. The problem is the tag cloud function returns results for both the album itself and all sub-albums as well (so a tag may have x number of hits even though the top-level album has zero). However, the hack I wrote above does not return sub-albums for the search query, so returns zero (not x).

I would like the hack to also search sub-albums, just not sure how to do it. I would have assumed that passing $album (or a version printed with foreach) would have done it, but I only get 'array,array,array'.

Administrator
Administrator
acrylian   08-11-2010, 10:00
#6

Please escape the code properly using backticks.

tags_from_album plugin (which has been renamed to tags_extras in the svn btw) has a function getAllTagsFromAlbum() has options to include subalbums or not. Of course since mainly images would be tagged the main purpose is to get the tags of these within the album. Last time I tried this worked well even in in the main album are no images itself.

It has also an option for getting the tags of the album and its subalbums itself.

Member
Member
jdaverth   08-11-2010, 10:28
#7

@acrylian - getAllTagsFromAlbum() works perfectly for returning the tags from album+subalabums, but the links it produces perform a search on the entire gallery, not on the currently selected album and/or subalbums.

Member
Member
jdaverth   08-11-2010, 10:29
#8

btw, I was using code + /code ... here is the code with backticks:

echo "[*]".$tname.$counter."".$separator."\n";

Administrator
Administrator
acrylian   08-11-2010, 10:47
#9

Ah, now I get the issue you have... You probably need to pass a list of all albums it should search on instead of just the first. Looks like this might be a good idea to add to the plugin's next version.

Member
Member
jdaverth   08-11-2010, 12:43
#10

probably so ... I feel as though the mod I used should work since the final parameter for getURL should be an array anyway, but for some reason it's not. I tried, as I said, using $array[0] and I do indeed seem to get an array consisting of the album id and title, but can't seem to pass the entire thing properly and don't see why. Surely I'm just missing something silly, but alas ...

Administrator
Administrator
acrylian   08-11-2010, 13:09
#11

You need to pass the album names, not the title or id.

Member
Member
jdaverth   08-11-2010, 22:41
#12

That's one of the oddities. In the example above, $album[0] actually returns both -- that is, the album number as well as the name (url path actually) of the current album. So, for example, if I am on a sub-album on level down, my tag will link to http://example.com/page/search/tags/TAG_NAME?inalbums=Album#,Album_Name/Sub-album_name,1
(not entirely sure what the '1' is at the end, but is common to all, so I presume it is the gallery root). As I said earlier, the query actually works perfectly on a sub-album.

So effectively, my variable $album[0] is actually outputting an array it seems. However, if I were to echo, say, $album[0][0], $album[0][1], etc. I get nothing whatsoever. Nor do I get anything if I were to echo $album[1], etc...

Member
Member
sbillard   08-11-2010, 23:06
#13

You are probably seein an artifact of PHP. The album list, when it is passed as the URL, is a comma separated list. The parameter to the getSearchURL() function is supposed to be an array, but if you instead passed a comma separated list it would accidentally work because of how the construct works that the function uses to join the array elements.

Member
Member
jdaverth   09-11-2010, 12:29
#14

@sbillard, Thanks for the plausible explanation! It doesn't solve my ultimate goal, of course, but at least I can rest easier with something that makes sense. For the OCD in me, something that works but shouldn't is 'almost' as bad as not working at all :-)

Member
Member
sbillard   09-11-2010, 19:56
#15

Well, that interface is changing anyway for the 1.3.2 release so you will get a "deprecated" error passing that parameter.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.