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.
ImageMagick 6.6.0-2 2010-07-13 Q16 http://www.imagemagick.org
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
@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!
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.
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'.
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.
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 ...
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...
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.