Pages (3): 1 2 3   
Member
Member
jackdaw   13-03-2010, 11:13
#1

Now I have

$listoftags = getTags(); echo $listoftags;
but that only returns 'Array'.
How can I print a list, seperated by comma's, of $listoftags?

Member
Member
jackdaw   13-03-2010, 11:36
#2

By the way, I know of the function printAllTagsAs, but I don't want to print ALL tags, just a list of tags used in a certain album.

Administrator
Administrator
acrylian   13-03-2010, 12:09
#3

Sometimes looking at the documentation really helps:
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

Member
Member
jackdaw   13-03-2010, 12:27
#4

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.

Administrator
Administrator
acrylian   13-03-2010, 12:36
#5

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.

Member
Member
jackdaw   13-03-2010, 12:59
#6

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.

Thanks for your information though .

Administrator
Administrator
acrylian   13-03-2010, 13:09
#7

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

Member
Member
jackdaw   13-03-2010, 13:15
#8

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.

Administrator
Administrator
acrylian   13-03-2010, 13:19
#9

Then just add the printTags() within that. Of course some CSS styling of the list will be required.

Member
Member
jackdaw   13-03-2010, 13:19
#10

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.

Administrator
Administrator
acrylian   13-03-2010, 13:51
#11

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.
Member
Member
jackdaw   13-03-2010, 14:35
#12

Well, option 1 is what I wanted. So I'll have to be patient I guess, until the idea gets out of your mind and into a future release of ZP .

Administrator
Administrator
acrylian   13-03-2010, 16:05
#13

Yes, sorry. (Or if you really badly need it you could also "sponsor" that feature/plugin.).

Administrator
Administrator
acrylian   14-03-2010, 20:32
#14

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.

Administrator
Administrator
acrylian   16-03-2010, 20:34
#15

You might want to test the new plugin "tags_from_album" in tonight's nightly.

Member
Member
jackdaw   18-03-2010, 10:29
#16

Hello Acrylian,

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

Administrator
Administrator
acrylian   18-03-2010, 10:51
#17

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.

Member
Member
jackdaw   18-03-2010, 11:25
#18

Ok, so now I did this:
printAllTagsFromAlbum($_zp_current_album->name,false,'images','',"",false,1,1,1,50)

but still the same (no) results and the same empty html output.

Administrator
Administrator
acrylian   18-03-2010, 12:03
#19

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 have of course tried it and it did work...)

Member
Member
jackdaw   18-03-2010, 12:14
#20

You can take a look at this album: cows.

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)

Pages (3): 1 2 3   
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.