Help - Search - Members - Calendar
Full Version: Conditional behaviors for specific topic(s)?
Movable Type Community Forum > Additional Resources > Tips and Tricks
ThatAdamGuy
I have many categories in my blog, and for one of them -- the "personal" topic -- I'd like to post a disclaimer at the top of the archives stating "Note that I often alter or obscure names, dates, places, and other info to protect my privacy and the privacy of others."

Is there a way to have this disclaimer displayed conditionally... specifically, only on the archives for one category... or better yet, also on any individual entries that are in that one category?
kadyellebee
If PHP is an option, you could use something like this on your  Individual archive templates:
CODE
<? if ("<$MTEntryCategory$>"=="personal") {
echo "Note that I often alter or obscure names, dates, places, and other info to protect my privacy and the privacy of others.";
} ?>

and on the Category Archives, you'd just need to switch the tag to MTArchiveCategory instead of MTEntryCategory.

Then you just put this where you want the next to appear, and voila! it only shows up when that category matches.

If PHP isn't an option, then I think Kevin's compare plugin would do this similarly - the MTIfEqual tag would go something like this (untested):
CODE
<MTIfEqual a="[MTEntryCategory]" b="personal">
Note that I often alter or obscure names, dates, places, and other info to protect my privacy and the privacy of others.
</MTIfEqual>

and again, you'd need to change the code to MTArchiveCategory for the category archive template.

Hope that helps,
Kristine
maddy
Brad's Supplementary Category Tags could be used, too, I suppose.
QUOTE
<MTIfCategory>: Used to output content if the current category (in the context of a category archive template) matches a given name or pattern. Or if used within the context of an entry, will compare against all the categories assigned to that entry.
<MTIfPrimaryCategory>: Much like ‘IfCategory’, but only compares with an entry’s primary category.


CODE
<MTIfCategory name="personal">
   Note that I often alter or obscure names, dates, places, and other info to protect my privacy and the privacy of others.
 </MTIfCategory>


smile.gif
ThatAdamGuy
Just a belated thanks for all the great tips!
I ended up going with Brad's Supplementary Category plugin, and you can see the result on blog here.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.