HDwiki精彩词条按人气排序
2010-09-25 15:42 来源:www.chinab4c.com 作者:admin
HDwiki精彩词条按人气排序,目前HDwiki的精彩词条是按照推荐来显示的。为了方便使用和让HDwiki变的更人性化.我们可以通过对HDwiki二次开发。达到HDwiki按照人气排行来显示.我们必须对HDwiki的block进行调整
1:block/default/doc/doc.php
function wonderdocs($setting){
$this->base->load('doc');
$num=$setting['num']?$setting['num']:$this->base->setting['index_wonderdoc'];
$type = 3;
$list = $_ENV["doc"]->get_by_votes(0,$num);
if(count($list)>0){
$fistwonderdoc=is_array($list)?array_shift($list):array();
$fistwonderdoc['image'] = str_replace('s_','',$fistwonderdoc['image']);
}
return array('config'=>$setting, 'list'=>$list, 'fistwonderdoc'=>$fistwonderdoc);
}
2:model/doc.class.php
function get_by_votes($start = 0 ,$limit = 10){
$sql = "select * FROM ".DB_TABLEPRE."doc d where visible = 1 order by votes desc LIMIT $start,$limit";
$query = $this->db->query($sql);
while($doc=$this->db->fetch_array($query)){
$doc['iscreate']=($doc['time']==$doc['lastedit']);
$doc['lastedit']=$this->base->date($doc['lastedit']);
$doc['time']=$this->base->date($doc['time']);
$doc['rawtitle']=$doc['title'];
$doc['title']=htmlspecialchars($doc['title']);
$doc['shorttitle']=(string::hstrlen($doc['title'])>16)?string::substring($doc['title'],0,16)."...":$doc['title'];
$doc['category']=$categorylist[$doc['cid']];
$doclist[]=$doc;
}
return $doclist;
}
3:block/default/doc/wonderdoc.htm修改成以下代码
<div id="jcct" class="columns jcct {$data['config']['style']}" bid="{$bid}">
<h2 class="col-h2">{lang wonderDoc}</h2>
<a href="{url list-focus-3}" class="more">{lang more}</a>
<ul class="col-ul point font-14 link_blue ">
<!--{loop $data['list'] $wondoc}-->
<li><a href="{url doc-view-$wondoc['did']}" >{$wondoc['title']}</a>: {$wondoc['summary']}</li>
<!--{/loop}-->
</ul>
</div>
最近更新
常用插件
- ecshop2.7.0utf给属性增加库存
插件介绍:本插件适合ecshop2.7.0的utf8编码对商品的属性进行库存管理...
- ecshop 后台商品列表图片显
ecshop 后台商品列表图片显示隐藏插件...
- ecshop购买流程中增加增值
ecshop购买流程中增加增值发票功能插件,主要是增加ecshop发票功能中的...
- ecshop通过ajax更新购物车
ecshop通过ajax更新购物车,本ecshop插件通过自动无刷新更新ecshop购物车,可...
- 详细页面ecshop运费查询插
详细页面ecshop运费查询插件主要是方便用户,在提交订单之前,为了了...