I have a channel entry loop that is outputting entries from three different channels. Entries from each channel are marked up differently, so I have a Switchee case with the value of channel_short_name
to determine which channel the entry is in and then output the appropriate markup.
{exp:switchee variable="{channel_short_name}" parse="inward"} {case value="channel_one"} ... (Channel one markup) {/case} {case value="channel_two"} ... (Channel two markup) {/case} {case value="channel_three"} ... (Channel three markup) {/case} {/exp:switchee}
Within one channel, I need to have two different layouts (based on status) and cycle between classes. I'm trying to accomplish this by nesting another Switchee case using status
as the value and {switch}
to cycle classes.
{exp:switchee variable="{channel_short_name}" parse="inward"}
{case value="channel_one"}
... (Channel one markup)
{/case}
{case value="channel_two"}
... (Channel two markup)
{/case}
{case value="channel_three"}
{switchee variable="{status}" parse="inward"}
{case value="Featured"}
<div class="channel-three featured">
<div class="{switch="class-a|class-b}"></div>
</div>
{/case}
{case default="yes"}
<div class="channel-three not-featured">
<div class="{switch="class-one|class-two|class-three}"></div>
</div>
{/case}
{/switchee}
{/case}
{/exp:switchee}
Finally, the issue I am having is the {switch}
markup nested in Switchee seems to cycle on every entry, wether the case it is wrapped in is true or not.
The output is something like this.
<div class="channel-three featured">
<div class="class-a"></div><!-- Expecting class-a -->
</div>
<div class="channel-three not-featured">
<div class="class-two"></div><!-- Expecting class-one -->
</div>
<div class="channel-three featured">
<div class="class-a></div><!-- Expecting class-b -->
</div>
Is {switch}
working as expected? Is there a different approach I should take on this? Any other plugins I should try?