This is probably not how the {switch} variable was intended to be used, but this isn’t working for me:
{exp:weblog:entries weblog="events" category="56" show_future_entries="yes" show_previous="yes"}
{switch='<div class="day"><h2>{entry_date format="%l %F %Y"}</h2>|'}
<div class="lecture">
{entry_date format=""}: {title}
</div>
{switch='|</div>'}It looks like the first switch isn’t getting parsed, since “{switch=..." appears in the output.
So for now I'm using the suggestion in this thread, which works but is a little wacky:
{exp:weblog:entries weblog="events" category="56" show_future_entries="yes" show_previous="yes"}
<!-- {switch="odd|even"} -->
{if "{switch="odd|even"}" == "odd"}
<div class="day">
<h2>{entry_date format="%l %F %Y"}</h2>
<p>{/if}<br />
<div class="lecture"><br />
{entry_date format=""}: {title}<br />
</div><br />
{if "{switch="odd|even"}" == "even"}<br />
</div><br />
{/if}<br />
{/exp:weblog:entries}Is it possible to use {switch} with a bigger block of code, which includes quotation marks and embedded tags? Or is my problem that my second invocation of switch is overriding my first invocation somehow?
Cheers,
Ben
P.S. Kudos to whomever wrote the syntax coloring code for these forums, that was quite the acid test.
[Mod Edit: Moved to the How To forum.]