Hi,
I try to show an element only within articles of a certain category (and the category itself). Is there an easy way to determine the category and to show either a whole Sidebar-Plugin or div element based on the category?
I suppose a sidebar plugin can't decide for itself whether it's been shown so I guess the div Element is the way to go?
Show element only in a certain category
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Show element only in a certain category
Hi!
Yes, you can check if $serendipity['GET']['category'] is empty or not; this holds the ID of the category that you are viewing (if you are viewing) if you custom-code a plugin.
You might need the categorytemplates event plugin in conjunction, so that it can set this variable when you are viewing a single entry that is only in one category (by default s9y has no "category-specific" single-entry view, it only knows a single-entry, not single-entry-within-category-X).
The serendipity_event_sidebarhider plugin might also be something you should look into.
Regards,
Garvin
Yes, you can check if $serendipity['GET']['category'] is empty or not; this holds the ID of the category that you are viewing (if you are viewing) if you custom-code a plugin.
You might need the categorytemplates event plugin in conjunction, so that it can set this variable when you are viewing a single entry that is only in one category (by default s9y has no "category-specific" single-entry view, it only knows a single-entry, not single-entry-within-category-X).
The serendipity_event_sidebarhider plugin might also be something you should look into.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/