This morning I was trying to figure out a way of listing my categories for a particular entry in this format: “Filed in: catergoy one, category two” where there may be none, one, or multiple categories, and “Filed in:” didn’t appear if there were no categories. The difficulty was I couldn’t test whether categories == “” or not, so I only had a choice of either:
A.
Filed in: category one
Filed in: category two
Filed in: category three
(ie “Filed in” appears for every loop (bad) but doesn’t appear when there are no categories (good))
or B.
Filed in: {categories}{/categories} where “Filed in:” appeared even if there were no categories (bad).
However using my css workaround for hiding paginate pages = 1 (4th post) I eventually realised I could so something similar, so now I have:
[b]<span class="category_text{categories}{category_id}{/categories}"><br />Filed in:</span>[/b]
{categories backspace="1"}
<a href="{path=SITE_INDEX}">{category_name}</a>,
{/categories}
then in my css:
.category_text {display:none;}
The trick is in the span around “Filed in:” which will now be hidden whenever there are categories, because by adding category id’s to the class name it becomes something meaningless like “category_text3129” and is therefore ignored by the rule to hide it.
Err I hope that makes sense, thought it might come in handy for someone. Its pretty easy (despite my explanation
