第一步:添加模型字段,这个模型可以是官方的,也可以是你自定义的模型,以单选字段形式添加就好了;
第二步:就是添加栏目和内容;
第三步:模板如下,照着改就好了。
- {template "content","header"}
- <!-- 开始取出字段--------------------------------------------- -->
- {pc:get sql="SELECT * FROM `v9_model_field` where `field`='fangshi' and `modelid`='3'" return="data"}
- <?php
- $optionsn='';
- eval("$setting_arr =".$data[0]['setting'].";");
- $optionsn=explode("
",$setting_arr['options']);
- $fangshi_array=array(); //修改这个地方
- foreach( $optionsn as $kk=>$vv){
- $optionsn_vv=explode("|",$vv);
- $fangshi_array[trim($optionsn_vv[1])]=trim($optionsn_vv[0]); //修改这个地方
- }
- ?>
- {/pc}
- {pc:get sql="SELECT * FROM `v9_model_field` where `field`='paytype' and `modelid`='3'" return="data"}
- <?php
- $optionsn='';
- eval("$setting_arr =".$data[0]['setting'].";");
- $optionsn=explode("
",$setting_arr['options']);
- $paytype_array=array(); //修改这个地方
- foreach( $optionsn as $kk=>$vv){
- $optionsn_vv=explode("|",$vv);
- $paytype_array[trim($optionsn_vv[1])]=trim($optionsn_vv[0]); //修改这个地方
- }
- ?>
- {/pc}
- {pc:get sql="SELECT * FROM `v9_model_field` where `field`='housetype' and `modelid`='3'" return="data"}
- <?php
- $optionsn='';
- eval("$setting_arr =".$data[0]['setting'].";");
- $optionsn=explode("
",$setting_arr['options']);
- $housetype_array=array(); //修改这个地方
- foreach( $optionsn as $kk=>$vv){
- $optionsn_vv=explode("|",$vv);
- $housetype_array[trim($optionsn_vv[1])]=trim($optionsn_vv[0]); //修改这个地方
- }
- ?>
- {/pc}
- {pc:get sql="SELECT * FROM `v9_model_field` where `field`='dingshi' and `modelid`='3'" return="data"}
- <?php
- $optionsn='';
- eval("$setting_arr =".$data[0]['setting'].";");
- $optionsn=explode("
",$setting_arr['options']);
- $dingshi_array=array(); //修改这个地方
- foreach( $optionsn as $kk=>$vv){
- $optionsn_vv=explode("|",$vv);
- $dingshi_array[trim($optionsn_vv[1])]=trim($optionsn_vv[0]); //修改这个地方
- }
- ?>
- {/pc}
- <!-- 结束取出字段--------------------------------------------- -->
- 织梦模板,phpcms模板免费下载 http://www.bbscms.net
- <!-- 开始拼装where -->
- <?php
- $where="";
- if(!empty($_GET['fangshi'])){
- $where.="`fangshi` = '".$_GET['fangshi']."' AND ";
- }
- if(!empty($_GET['paytype'])){
- $where.="`paytype` = '".$_GET['paytype']."' AND ";
- }
- if(!empty($_GET['housetype'])){
- $where.="`housetype` = '".$_GET['housetype']."' AND ";
- }
- if(!empty($_GET['dingshi'])){
- $where.="`dingshi` = '".$_GET['dingshi']."' AND ";
- }
- $where.=1;
- ?>
- <!-- 结束拼装where -->
- <!--main-->
- <div class="main photo-channel">
- <div class="crumbs"><a href="{siteurl($siteid)}">首页</a><span> > {catpos($catid)}</div>
- <div class="bk10"></div>
- <style>
- .udiv{ margin-bottom:10px;}
- .ucurent{ background:#FF0; padding:2px; font-weight:bold;}
- </style>
- <div class="udiv"><strong>租房方式</strong>:
- <span><a href="{APP_PATH}index.php?m=content&c=index&a=lists&catid={$catid}&paytype={$_GET['paytype']}&housetype={$_GET['housetype']}&fangshi=&dingshi={$_GET['dingshi']}&page={$_GET['page']}" {if $_GET['fangshi']==''}class="ucurent"{/if}>全部</a></span>
- {loop $fangshi_array $k $val}
- <span><a href="{APP_PATH}index.php?m=content&c=index&a=lists&catid={$catid}&paytype={$_GET['paytype']}&housetype={$_GET['housetype']}&fangshi={$k}&dingshi={$_GET['dingshi']}&page={$_GET['page']}" {if $_GET['fangshi']==$k}class="ucurent"{/if}>{$val}</a></span>
- {/loop}
- </div>
- <div class="udiv"><strong>支付方式</strong>:
- <span><a href="{APP_PATH}index.php?m=content&c=index&a=lists&catid={$catid}&paytype=&housetype={$_GET['housetype']}&fangshi={$_GET['fangshi']}&dingshi={$_GET['dingshi']}&page={$_GET['page']}" {if $_GET['paytype']==''}class="ucurent"{/if}>全部</a></span>
- {loop $paytype_array $k $val}
- <span><a href="{APP_PATH}index.php?m=content&c=index&a=lists&catid={$catid}&paytype={$k}&housetype={$_GET['housetype']}&fangshi={$_GET['fangshi']}&dingshi={$_GET['dingshi']}&page={$_GET['page']}" {if $_GET['paytype']==$k}class="ucurent"{/if}>{$val}</a></span>
- {/loop}
- </div>
- <div class="udiv"><strong>房屋类型</strong>:
- <span><a href="{APP_PATH}index.php?m=content&c=index&a=lists&catid={$catid}&paytype={$_GET['paytype']}&housetype=&fangshi={$_GET['fangshi']}&dingshi={$_GET['dingshi']}&page={$_GET['page']}" {if $_GET['housetype']==''}class="ucurent"{/if}>全部</a></span>
- {loop $housetype_array $k $val}
- <span><a href="{APP_PATH}index.php?m=content&c=index&a=lists&catid={$catid}&paytype={$_GET['paytype']}&housetype={$k}&fangshi={$_GET['fangshi']}&dingshi={$_GET['dingshi']}&page={$_GET['page']}" {if $_GET['housetype']==$k}class="ucurent"{/if}>{$val}</a></span>
- {/loop}
- </div>
- <div class="udiv"><strong>厅室</strong>:
- <span><a href="{APP_PATH}index.php?m=content&c=index&a=lists&catid={$catid}&paytype={$_GET['paytype']}&housetype={$_GET['housetype']}&fangshi={$_GET['fangshi']}&dingshi=&page={$_GET['page']}" {if $_GET['dingshi']==''}class="ucurent"{/if}>全部</a></span>
- {loop $dingshi_array $k $val}
- <span><a href="{APP_PATH}index.php?m=content&c=index&a=lists&catid={$catid}&paytype={$_GET['paytype']}&housetype={$k}&fangshi={$_GET['fangshi']}&dingshi={$k}&page={$_GET['page']}" {if $_GET['dingshi']==$k}class="ucurent"{/if}>{$val}</a></span>
- {/loop}
- </div>
- <br /><br />
- {pc:content action="lists" catid="$catid" where="$where" order="listorder DESC" thumb="1" num="12" return="data" page="$_GET['page']"}
- <ul class="photo-list picbig">
- {loop $data $r}
- <li>
- <div class="img-wrap">
- <a href="{$r[url]}"><img src="{thumb($r[thumb],150,112)}" width="150" height="112" alt="{$r[title]}"/></a>
- </div>
- <span style="color:{$r[style]}">{str_cut($r[title],28)}</span>
- </li>
- {/loop}
- </ul>
- <div id="pages" class="text-c">{$pages}</div>
- {/pc}
- </div>
- </div>
- {template "content","footer"}
|