Help - Search - Members - Calendar
Full Version: If Parent Category = ...
Movable Type Community Forum > Using Movable Type > Categories and Entry Tags
Big-Un
Hello.
I'm trying to have MT use different Entry Listing (category) template modules depending on whether or not an archive belongs to one parent or another.
For example, I have two top level categories: Necklaces and Earrings. Within those, there are subcategories that sometimes have the same names such as Gold.
What I want to do is have a conditional statement that says if an entry archive belongs to Necklaces and is Gold, use the Necklaces template. But if it belongs to Earrings, use the Earrings template.

So, how do I write the conditional statement?
Right now I have
<mt:IfCategory name="GOLD">
<$mt:include module="necklaceModule"$>
</mt:IfCategory>

But is there a way to specify which parent category I mean, since both of them have a GOLD?
OtherNiceMan
Try

CODE
<mt:IfCategory name="GOLD">
   <mt:IfCategory name="necklace" type="primary">
      <$mt:include module="necklaceModule"$>
  </mt:IfCategory>
   <mt:IfCategory name="earings" type="primary">
      <$mt:include module="earingsModule"$>
  </mt:IfCategory>
</mt:IfCategory>


It might be more efficient to skip the check for GOLD.

http://www.movabletype.org/documentation/a...ifcategory.html
Big-Un
Thank you!
I haven't tried it yet but that's the right idea.
I'll see if that works.



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-2009 Invision Power Services, Inc.