nested if else in smarty not working as expected
<pre><code>{if $contents.id != "7" and $contents.id &lt; "128" and $contents.id &gt; "164"}
    &lt;div class="contentdiv"&gt;
        .....//some code
    &lt;/div&gt; 

{elseif $contents.id != "7" and $contents.id &gt; "129" and $contents.id &lt; "135"}
    &lt;div class="contentdiv"&gt;
        .....//some code
    &lt;/div&gt; 

{elseif $contents.id != "7" and $contents.id &gt; "135" and $contents.id &lt; "149"}
    &lt;div class="contentdiv"&gt;
        .....//some code
    &lt;/div&gt; 

{elseif $contents.id != "7" and $contents.id &gt; "149" and $contents.id &lt; "154"}
    &lt;div class="contentdiv"&gt;
        .....//some code
    &lt;/div&gt; 

{elseif $contents.id != "7" and  $contents.id &gt; "154" and $contents.id &lt; "161" and $contents.id eq "199" }
    &lt;div class="contentdiv"&gt;
        .....//some code
    &lt;/div&gt; 

{else}
    .....//some code
{/if}
</code></pre>

<p>The above code is not working as expected. I am new to smarty and how does this if else works for this multiple condition. Only the first two condition is getting executed and giving the expected result</p>