解决思路:
带解决问题是:0,
已解决问题是:1,
高悬赏是:2,
零回答是:3
通过传递一个参数来判断是那个:
<ul class=‘ans-sel‘> <li <if condition=‘$filter eq 0‘>class=‘on‘</if>> <a href="{:U(‘index‘,array(‘id‘=>$cateid))}">待解决问题</a> </li> <li <if condition=‘$filter eq 1‘>class=‘on‘</if>> <a href="{:U(‘index‘,array(‘id‘=>$cateid,‘filter‘=>1))}">已解决</a> </li> <li <if condition=‘$filter eq 2‘>class=‘on‘</if>> <a href="{:U(‘index‘,array(‘id‘=>$cateid,‘filter‘=>2))}">高悬赏</a> </li> <li class=‘last <if condition="$filter eq 3">on</if>‘> <a href="{:U(‘index‘,array(‘id‘=>$cateid,‘filter‘=>3))}">零回答</a> </li> </ul>
PHP示例:
//组合筛选条件 $filter = I(‘get.filter‘,‘‘,‘intval‘); $filter = isset($filter) ? $filter : 0; switch($filter){ case 1: $wwhere[‘solve‘] = 1; break; case 2: $wwhere[‘reward‘] = array(‘GT‘,0); break; case 3: $wwhere[‘answer‘] = 0; break; default : $wwhere[‘solve‘] = 0; }
时间: 2024-10-14 01:53:04