I know what an array is, but don't really know how to use it. I read the instructions on printTags, but it somehow illudes me.
On a page with thumbs I would like the list of tags to appear (tags associated with images inside that album) In album.php I have this:
` $listoftags = getTags(); printTags('links',NULL,'taglist',', ',TRUE,'',true); printTags($listoftags); ` but both the second and third line result in 'no tags' message, while some of the images inside this album do have tags.
You should really read the doc carefully. `printTags()` prints the tags of the current album or image. It depends in which context you use it. I admit that not directly written there. But take a look how the standard themes use that function.
You can't pass an array (the doc does not tell you that at all...). So on album.php or within the next_album loop it will print the album tagsg and on image.php or within the next_image loop it will print the image tags. (it will also print tags for Zenpage pages or news articles btw if used in that context).
So you only need your 2nd line but in the right context.
So if I understand you correctly, what I want is not possible, because I want the tags of all the seperate images within an album displayed on the page with the thumbs (within album.php). That would make sense to me because then, inside an album with the title 'mammals' I could quickly jump to 'dogs' or 'german' or 'sheppard'.
It would be nice if this was possible in the future.
I probably do not understand. So do you want to display all tags of all images within that album or the tags for each image in that album? The last is possible if you use the function within the next_image loop.
The first is possible too but requires custom coding. I have something like that on my list though but it's not the only one..;-)
The tags for each image in an album is what I would like, so I would have to look into the next_image loop. I'll do that, and hopefully get it to work . Thanks.
Uh... sorry, but are the two options you mentioned not exactly the same??? After reading your reply again I think what I want is option 1 and not option 2 as I mentioned in my previous reply.
So: all tags for all images inside that album in one list beneath or aside from the thumbs.
No. 1. Would collect all tags of all images in the album and display them as one list. (not possible without coding). 2. Prints the tags for each image individually.
Well, I figured I would like to have this function, too. So I indeed started on a plugin. Not sure if that will become an official one but I will make it surely available somehow.
but with the same result. Perhaps I'm doing something wrong. It would be nice if the function could return a taglist of a specified album > images, but in general I think it should return the tags from the current album > images.
But like I said, perhaps I'm not using the function correctly.
The first does not work, this function requires an album to be set.
Is "cows" a subalbum? Subalbum names are not the direct folder name but the path including parentlevels: `toplevelalbum/sublevelalbum/...`. The easiest to get the right name is to use `$_zp_current_album->name` if you are in album context. Otherwise you need to remember that manually.
Are you really sure that the images in that album have tags and that you are in album context??? Are there really direct images in that album you are trying? If not the 2nd parameter needs to be "true". Or any errors in the server log maybe?
I fear I can't reproduce it. Neither on my local MAMP install nor on my live test site. See here working as expected: http://zenphoto.maltem.de/album1 Called with `printAllTagsFromAlbum($_zp_current_album->name,false,"images");` right before the description call and the next_image loop.
There must be something different. Maybe you can try a standard theme?
I guess the MySQL version might then be the cause of this althought I think this should actuall work with 4. But I wonder why there is no error message then...
Could you maybe upgrade to MySQL 5? We recommend that anyway...
I did some investigation and found out that the query I originally adapted indeed did not work exactly as expected. So I reworked it. The change will be in tonight's nightly. Please give it a try, it should really not require MySQL 5.
Comments
http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintTags
There is nearly always a get/print pair of functions.
Do you know what an array is? If not I suggest to learn the php basics. To print an array you need to loop through it. For a one dimensional array like this one: http://www.php.net/manual/en/control-structures.foreach.php
Infos on array: http://php.net/manual/de/language.types.array.php
I read the instructions on printTags, but it somehow illudes me.
On a page with thumbs I would like the list of tags to appear (tags associated with images inside that album) In album.php I have this:
`
$listoftags = getTags();
printTags('links',NULL,'taglist',', ',TRUE,'',true);
printTags($listoftags);
`
but both the second and third line result in 'no tags' message, while some of the images inside this album do have tags.
You can't pass an array (the doc does not tell you that at all...). So on album.php or within the next_album loop it will print the album tagsg and on image.php or within the next_image loop it will print the image tags. (it will also print tags for Zenpage pages or news articles btw if used in that context).
So you only need your 2nd line but in the right context.
It would be nice if this was possible in the future.
Thanks for your information though .
The first is possible too but requires custom coding. I have something like that on my list though but it's not the only one..;-)
After reading your reply again I think what I want is option 1 and not option 2 as I mentioned in my previous reply.
So: all tags for all images inside that album in one list beneath or aside from the thumbs.
1. Would collect all tags of all images in the album and display them as one list. (not possible without coding).
2. Prints the tags for each image individually.
I just tried the plugin, but somehow I'm not getting any results.
First I tried this:
`printAllTagsFromAlbum("",false,'images','',"",false,1,1,1,50)`
as I expected the function to automatically return the tags from the images within the current album. But with this I get:
`
`No link, no text.
Then I tried
`printAllTagsFromAlbum("cows",false,'images','',"",false,1,1,1,50)`
but with the same result. Perhaps I'm doing something wrong. It would be nice if the function could return a taglist of a specified album > images, but in general I think it should return the tags from the current album > images.
But like I said, perhaps I'm not using the function correctly.
EDIT: I placed the function in album.php...
Is "cows" a subalbum? Subalbum names are not the direct folder name but the path including parentlevels: `toplevelalbum/sublevelalbum/...`. The easiest to get the right name is to use `$_zp_current_album->name` if you are in album context. Otherwise you need to remember that manually.
`printAllTagsFromAlbum($_zp_current_album->name,false,'images','',"",false,1,1,1,50)`
but still the same (no) results and the same empty html output.
(I have of course tried it and it did work...)
The first four pictures I gave tags. Underneath the thumbs I placed the code
`printAllTagsFromAlbum($_zp_current_album->name,false,'images','',"",false,1,1,1,50)`
Called with `printAllTagsFromAlbum($_zp_current_album->name,false,"images");` right before the description call and the next_image loop.
There must be something different. Maybe you can try a standard theme?
` (130)`
MYSQL 4.1.22
Could you maybe upgrade to MySQL 5? We recommend that anyway...
`
<?php
echo "Trefwoorden in dit album: ";
printAllTagsFromAlbum($_zp_current_album->name,false,"images","","",false,1,1,1,50)
?>
`