<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr class="title">
<td align="center">选择</td>
<if condition="$pid eq 1 or $pid eq 117 or $pid eq 3961 or $pid eq 3964 ">
<td align="center">分数</td>
<else/>
<td align="center">序号</td>
</if>
<td align="center">结果</td>
<td align="center">您的答案</td>
<td align="center">正确答案</td>
<td align="left">操作</td>
</tr>
<volist name="list" id="l">
<tr class="tdbg<if condition="($key % 2) eq 0">1<else />2</if>">
<td align="center">
<input type="checkbox" <if condition="$l.check eq 0">checked="true"</if> name="ebookid" value="{$l.id}" />
</td>
<if condition="$pid eq 121 or $pid eq 117 or $pid eq 3961 or $pid eq 3964 and $subjective eq 1">
<td align="center"><input type="text" value="{$l.}" style="width:20px;" readonly></td>
<td align="center">{$l.img}</td>
<elseif condition="$pid eq 121 or $pid eq 117 or $pid eq 3961 or $pid eq 3964 and $subjective eq 2"/>
<td align="center"><input type="text" value="{$l.}" style="width:20px;" readonly></td>
<td align="center"><input type="text" style="width:20px;"></td>
<else/>
<td align="center"><font class="numlist" qid="{$l.id}">...</font></td>
<td align="center">{$l.img}</td>
</if>
<td align="center" id="myanswer_{$l.id}">{$l.myanswer}</td>
<td align="center" id="answer_{$l.id}">{$l.answer}</td>
<td align="left">
<a href="javascript:;" onclick="showAnalysis({$l.id});" class="btn_green pngpic">详细解析</a>
<a href="javascript:;" onclick="showEbook({$l.id});" class="btn_orange pngpic">加入错题本</a>
<if condition="isset($l['zgt'])">
{$l.zgt}
</if>
</td>
</tr>
</volist>
<tr class="title2">
<td colspan="6" align="left">
<a href="javascript:;" onclick="addEbook();" class="addtowrongbook"></a>
</td>
</tr>
</table>
在$subjective eq 2 和$subjective eq 1这个地方,我的数据有2条$subjective 值为1,其他8条都为2,但是页面显示出来$subjective为1的显示了8条,$subjective 为 2的显示了2条,怎么回事啊
<tr class="title">
<td align="center">选择</td>
<if condition="$pid eq 1 or $pid eq 117 or $pid eq 3961 or $pid eq 3964 ">
<td align="center">分数</td>
<else/>
<td align="center">序号</td>
</if>
<td align="center">结果</td>
<td align="center">您的答案</td>
<td align="center">正确答案</td>
<td align="left">操作</td>
</tr>
<volist name="list" id="l">
<tr class="tdbg<if condition="($key % 2) eq 0">1<else />2</if>">
<td align="center">
<input type="checkbox" <if condition="$l.check eq 0">checked="true"</if> name="ebookid" value="{$l.id}" />
</td>
<if condition="$pid eq 121 or $pid eq 117 or $pid eq 3961 or $pid eq 3964 and $subjective eq 1">
<td align="center"><input type="text" value="{$l.}" style="width:20px;" readonly></td>
<td align="center">{$l.img}</td>
<elseif condition="$pid eq 121 or $pid eq 117 or $pid eq 3961 or $pid eq 3964 and $subjective eq 2"/>
<td align="center"><input type="text" value="{$l.}" style="width:20px;" readonly></td>
<td align="center"><input type="text" style="width:20px;"></td>
<else/>
<td align="center"><font class="numlist" qid="{$l.id}">...</font></td>
<td align="center">{$l.img}</td>
</if>
<td align="center" id="myanswer_{$l.id}">{$l.myanswer}</td>
<td align="center" id="answer_{$l.id}">{$l.answer}</td>
<td align="left">
<a href="javascript:;" onclick="showAnalysis({$l.id});" class="btn_green pngpic">详细解析</a>
<a href="javascript:;" onclick="showEbook({$l.id});" class="btn_orange pngpic">加入错题本</a>
<if condition="isset($l['zgt'])">
{$l.zgt}
</if>
</td>
</tr>
</volist>
<tr class="title2">
<td colspan="6" align="left">
<a href="javascript:;" onclick="addEbook();" class="addtowrongbook"></a>
</td>
</tr>
</table>
在$subjective eq 2 和$subjective eq 1这个地方,我的数据有2条$subjective 值为1,其他8条都为2,但是页面显示出来$subjective为1的显示了8条,$subjective 为 2的显示了2条,怎么回事啊
$pid eq 121 or $pid eq 117 or $pid eq 3961 or $pid eq 3964 and $subjective eq 1你的 and 只与 $pid eq 3964 结合,当 $pid 为其他值时 并不受其制约
估计应为
($pid eq 121 or $pid eq 117 or $pid eq 3961 or $pid eq 3964) and $subjective eq 1
pid 为 121、117、3961、3964 之一
写成代码不就是 ($pid eq 121 or $pid eq 117 or $pid eq 3961 or $pid eq 3964) 吗
注意使用括号括起的,希望你的模板引擎支持这个写法
但是我这样写之后,即使有subjective为1的数据也是执行了subjective为2的语句,我用的是thinkphp。
<elseif condition="($pid eq 121 or $pid eq 117 or $pid eq 3961 or $pid eq 3964) and $subjective eq 2"/>
这是我的<if condition="($pid eq 121 or $pid eq 117 or $pid eq 3961 or $pid eq 3964) and $subjective eq 1">
<elseif condition="($pid eq 121 or $pid eq 117 or $pid eq 3961 or $pid eq 3964) and $subjective eq 2"/>