Nested commands produce odd results

I’m trying to create a display template for a collection and I’m getting contradictory results. I’ve simplified the template to the basics to debug but I can’t resolve the problem. Perhaps there is a setting that I’m overlooking.

Here’s the output :

Hello from ELSE switch of Type is "board meeting"
    (We are NOT a board meeting!)
    Hello from Type is "project" 
        (Nested within ELSE switch of Type is "board meeting")
        (We ARE a Project)
        Goodbye from Type is "project"
    Hello from ELSE switch of Type is "project"
        (Nested within ELSE switch of Type is "board meeting")
        (We are NOT a Project)
        Goodbye from Type is NOT a "project"
Goodbye from ELSE switch of Type is "board meeting"

Here’s the code :slight_smile:

<?if =$type$= eq "board meeting" ?>
	<p>Hello from Type is "board meeting"</p>
	<p>(We ARE a board meeting)</p>
	<p>Goodbye from Type is "board meeting"</p>
<?else?>
	<p>Hello from ELSE switch of Type is "board meeting"</p>
	<p>(We are NOT a board meeting!)</p>
	<?if =$type$= eq "project" ?>
		<p>Hello from Type is "project" (Nested within ELSE switch of Type is "board meeting")</p>
		<p>(We ARE a Project)</p>
		<p>Goodbye from Type is "project" </p>
	<?else?>
		<p>Hello from ELSE switch of Type is "project"</p>
		<p>(Nested within ELSE switch of Type is "board meeting")</p>
		<p>(We are NOT a Project)</p>
		<p>Goodbye from Type is NOT a "project" </p>
	<?endif ?>
	<p>Goodbye from ELSE switch of Type is "board meeting"</p>
<?endif?>

Any suggestions appreciated.

The template commands can be nested, but they can’t be indented. They all have to start in column 1.

Give that a try and see how that works out.

Ouch!

I remember reading that and thinking it was an odd requirement, then I forgot all about it.

thanks for the reminder.

1 Like