I would like to be able to call the album tags for each image, instead of each image having individual tags.
For example: When creating an album, tags would be defined for that album and those tags would be displayed for every image within that album.
Comments
I enabled the tags_from_album plugin and placed the following code on my image.php, but all I got was SQL errors.
[code]
<?php printAllTagsFromAlbum("sasha",false,albums,'|','',false,true,1,5,1,50); ?>
[/code]
MySQL Query ( SELECT DISTINCT t.name, t.id, (SELECT DISTINCT COUNT(*) FROM `zp_obj_to_tag` WHERE tagid = t.id AND o.type = 'albums') as count `zp_obj_to_tag`as o,`zp_tags`as t WHERE (o.objectid =10 AND o.tagid = t.id AND o.type = 'albums') ORDER by t.name ) failed. MySQL returned the error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`zp_obj_to_tag`as o,`zp_tags`as t WHERE (o.objectid =10 AND o.tagid = t.id AND o' at line 1
Regarding your function call `<?php printAllTagsFromAlbum("sasha",false,albums,'|','',false,true,1,5,1,50); ?>`. Try setting the `albums` parameter as `"albums"` (in quotes). Is the album "sasha" a toplevel album? If not you have to write "toplevel/sublevel(...)".
Maybe you could also tell what MySQL version you are running. It seems that one value is empty on your sql but I don't know right now why that can happen.
"sasha" is the name of the toplevel album folder.
I tried putting albums in quotes... Same error
I tried putting "toplevel(sasha)".... same error.
Thank you for posting the SQL error. Could not have seen this without that hint.
Here is the adjustment.
[code]
$tags = query_full_array("SELECT DISTINCT t.name, t.id, (SELECT DISTINCT COUNT(*) FROM ". prefix('obj_to_tag'). " WHERE tagid = t.id AND type = 'images') as count FROM ". prefix('obj_to_tag'). " as o,". prefix('tags'). " as t".$tagWhere." ORDER by t.name");
[/code]
I still get the same error.
should be...
[code]
$tags = query_full_array("SELECT DISTINCT t.name, t.id, (SELECT DISTINCT COUNT(*) FROM ". prefix('obj_to_tag'). " WHERE tagid = t.id AND o.type = 'albums') AS count FROM ". prefix('obj_to_tag'). "AS o, " . prefix('tags'). " AS t " .$tagWhere. " ORDER by t.name");
[/code]
(Btw, we don't use bbcode on the forum, just use `backticks`)
ok, this is what im using on my image.php.... I'm looking for a way for it to return the current album and I thought that this would do it. However it returning all tags from all albums instead.
Any ideas?
<?php printAllTagsFromAlbum(getAlbumTitle(""),false,"albums",'|','',false,true,1,5,1,50); ?>
Had the quotes wrong.
`<?php printAllTagsFromAlbum(getAlbumTitle(""),false,"albums",'|','',false,true,1,5,1,50); ?>`
The call is still wrong. The first parameter must be the album folder name not the title. The title can be "album1" while the actual name on the filesystem can be "album2".
Also if the album is a subalbum of an album named "topalbum2" then the name of the subalbum is "topalbum2/album2".
In my gallery there will be no subalbulms.
It works now because the folder name is the title, but if I make another sasha album, which is highly likely it wont work.
What would be the proper way to call all tags from all albums? It's something I would like to put on the index.php and perhaps some other pages.
Seems to be pulling album tags from multiple albums. Note the empty string.
Any idea why thats working or whats going on?
Sorry for so many questions.
I took a look at the function. There are indications that an empty album name should mean something, but in fact all that seems to happen is that it does an SQL search for folders with no name (not a likely match.) You might try setting the second parameter to true, that will give something different, but maybe not any more useful.
Acrylan will have to comment on this when Germany wakes up in the morning.
`<?php printAllTagsFromAlbum("$_zp_current_album->name",false,"albums",' · ','tags',false,true,1,3,1,2); ?>`
Where 'tags' is my CSS. The CSS is located in my header php file.
`
.tags a {
color: #FF0CFF;
text-decoration: none;
}
.tags a:hover {
color: #000000;
text-decoration: underline;
}
`