{if $contents.id != "7" and $contents.id < "128" and $contents.id > "164"}
<div class="contentdiv">
.....//some code
</div>
{elseif $contents.id != "7" and $contents.id > "129" and $contents.id < "135"}
<div class="contentdiv">
.....//some code
</div>
{elseif $contents.id != "7" and $contents.id > "135" and $contents.id < "149"}
<div class="contentdiv">
.....//some code
</div>
{elseif $contents.id != "7" and $contents.id > "149" and $contents.id < "154"}
<div class="contentdiv">
.....//some code
</div>
{elseif $contents.id != "7" and $contents.id > "154" and $contents.id < "161" and $contents.id eq "199" }
<div class="contentdiv">
.....//some code
</div>
{else}
.....//some code
{/if}
上述代码未按预期工作。我是聪明的新手,如果其他情况适用于这种多重条件。只有前两个条件被执行并给出预期结果
答案 0 :(得分:2)
这不是一个聪明的问题,只是你的逻辑是完全错误的:
$contents.id < "128" and $contents.id > "164"
怎么可能是一个低于128且大于164的数字?
$contents.id > "154" and $contents.id < "161" and $contents.id eq "199"
或介于154和161之间,等于199?