ZenphotoCMS Forum
Check for specific tag - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Check for specific tag (/thread-10343.html)



Check for specific tag - NaturalEnquirer - 2012-08-29

I would like to print some information on the image page only if a certain tag exists for an image. E.g. If an image is tagged as a plant, I'd like to include its endangered status.

After reading several posts, it seems I should be able to do somehing like this:

`




Check for specific tag - sbillard - 2012-08-29

When pages are "killed" there is always an error message. That message would be critical to understanding what is wrong.




Check for specific tag - NaturalEnquirer - 2012-08-30

It generate a 500 internal server error ... No errors in zenphoto debug log.




Check for specific tag - sbillard - 2012-08-30

Nothing in what yo show that should cause a 500 error. Maybe it is how you inserted the code or where you inserted it.




Check for specific tag - acrylian - 2012-08-30

Btw, there is an object model method for checking a tag:
http://www.zenphoto.org/documentation/classes/ThemeObject.html#methodhasTag

Again we have a documentation and try hard to name all function after what they do.

A 500 internal error I don't understand as well but on some later PHP 5 versions it might cause a notice to pass "getTags()" directly. Preferred is to first put the value into a var.




Check for specific tag - NaturalEnquirer - 2012-08-31

Thank you for pointing me toward the hasTag() function. This is what worked for me:

`

[list][*][/list]




Check for specific tag - acrylian - 2012-08-31

Exactly how it should be used..;-) This works with all objects of albums, Zenpage pages and articles, too.