久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      phpcms如何調(diào)取最近更新的文章

      phpcms如何調(diào)取最近更新的文章

      phpcms如何調(diào)取最近更新的文章?

      phpcms v9調(diào)用全站最新文章(最近更新所有內(nèi)容)

      第一步 修改 phpcmsmodulescontentclasses content_tag.class.php 在最后面的 } 上面添加

      public function newcontent($data){ $num = intval($data['limit']) ? intval($data['limit']) : '20'; // 設(shè)置排序 switch($data['order']){ case '1': $order = ' `id` ASC '; break; case '2': $order = ' `id` DESC '; break; case '3': $order = ' `inputtime` ASC '; break; case '4': $order = ' `inputtime` DESC '; break; case '5': $order = ' `updatetime` ASC '; break; case '6': $order = ' `updatetime` DESC '; break; default: $order = ' `id` DESC '; } if($data['catid']){ $catids = explode(',', $data['catid']); foreach($catids as $catid){ $catid = intval($catid); if(empty($catid))continue; $this->set_modelid($catid); $where = $this->category[$catid]['child'] ? ' `catid` IN ('.$this->category[$catid]['arrchildid'].')' : " `catid` = $catid"; $datas = $this->db->select($where, '*', $num, $order); $data[$catid]['data'] = $datas; // 記錄本次的文章數(shù) $data['num'][] = count($datas); $model_num++; } }else{ $models = getcache('model', 'commons'); foreach($models as $model){ $this->db->set_model($model['modelid']); $datas = $this->db->select('', '*', $num, $order); $data[$model['modelid']]['data'] = $datas; // 記錄本次的文章數(shù) $data['num'][] = count($datas); $model_num++; } } if($data){ // 獲取每個(gè)模型應(yīng)該截取的條數(shù) $num = ceil($num/$model_num); // 循環(huán)條數(shù)記錄用于找出條數(shù)不滿足的數(shù)量然后進(jìn)行平均 $w_num = $w_num_t = ''; foreach($data['num'] as $num_t){ if($num_t < $num){ $w_num += $num-$num_t; $w_num_t++; } } // 判斷是否有不滿足平均數(shù)的 如果有那么就增加平均值 if($w_num_t){ $num += ceil($w_num/($model_num-$w_num_t)); } $datas = array(); foreach($data as $r){ $r_n = ''; if(is_array($r['data'])) foreach($r['data'] as $r_t){ $datas[] = $r_t; if(++$r_n == $num)break; } } return $datas; }else{ return false; } }

      第二步:模板調(diào)用

      其實(shí)就和默認(rèn)的文章列表調(diào)用差不多

      {pc:content action="newcontent" }

      參數(shù)說(shuō)明:

      catid: 可有可無(wú) 加了就只調(diào)用指定欄目的信息 多個(gè)欄目請(qǐng)使用英文半角的 ,間隔

      order:排序 參數(shù)值:1-7 具體的含義在代碼里面很容易看明白 不祥述

      num:調(diào)用數(shù)量 不指定默認(rèn)調(diào)用20條

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)