<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条,怎么回事啊

解决方案 »

  1.   

    你是指这个?
    $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
      

  2.   

    按照你写的,只执行了$pid eq 121 or $pid eq 117 or $pid eq 3961 or $pid eq 3964 and $subjective eq 2 的这个条件,前面那个条件就不执行了!
      

  3.   

    这是一个试卷,分为主观题和客观题,我想主观和客观显示不一样,条件就是在满足id的情况下, $l.img是一个图片,$subjective 的值为1是主观,这个图片显示,为2是客观,这个地方变成一个输入框!可能我说的不明确!
      

  4.   

    你真够可以的,如果你是主管,你手下的兵可定都跑光了当 pid 为 121、117、3961、3964 之一 并且 subjective 等于 1 时,显示代表主观的图片是这个意思吗?
      

  5.   

    对,当 pid 为 121、117、3961、3964 之一 并且 subjective 等于 2的时候,图片那一格变成一个输入框 
      

  6.   

    那不就对了吗?
    pid 为 121、117、3961、3964 之一
    写成代码不就是 ($pid eq 121 or $pid eq 117 or $pid eq 3961 or $pid eq 3964) 吗
    注意使用括号括起的,希望你的模板引擎支持这个写法
      

  7.   

     
    但是我这样写之后,即使有subjective为1的数据也是执行了subjective为2的语句,我用的是thinkphp。
      

  8.   

    <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"/>
      

  9.   


    这是我的<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"/>