小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

簡(jiǎn)單的PHPCMS V9自定義欄目偽靜態(tài)實(shí)現(xiàn)方法

 網(wǎng)絡(luò)學(xué)習(xí)天空 2014-05-16

今天在優(yōu)化phpcms v9欄目偽靜態(tài)是,自定義欄目無(wú)法偽靜態(tài),于是就搜索了一下,總結(jié)如下:
phpcmsV9
欄目偽靜態(tài)的修改方法(支持自定義目錄名),官方程序默認(rèn)偽靜態(tài)是不支持自定義欄目名的,所以今天就做了以下修改,讓其支持!

  首先看urlrewrite的規(guī)則,這個(gè)是IIS6下的,其它環(huán)境下的規(guī)則自己轉(zhuǎn)換下

  RewriteRule /phpcms/(.*)(.*)/ /phpcms/index.php?m=contentc=indexa=listscategorydir=$1catdir=$2 RewriteRule /phpcms/(.*)(.*)/([0-9]+)/ www.visa158.com/phpcms/index.php?m=contentc=indexa=listscategorydir=$1catdir=$2page=$3

  1、打開phpcmsmodulescontent目錄下的index.php找到 public function lists() {,將$catid = intval($_GET['catid']);替換成:

  if(isset ($_GET['catid'])){ $catid = intval($_GET['catid']); }else{ $catdir=$_GET['catdir']; if($catdir==""){ $catdir=$_GET['categorydir']; } $s=$this->_getCategoryId($catdir); $catid=$s[0][catid]; }

  并且在最后的}?> 前添加:

  /** *根據(jù)欄目名獲得ID * @param <type> $catdir */ function _getCategoryId($catdir){ $this->category_db = pc_base::load_model('category_model'); $result = $this->category_db->select(array('catdir'=>$catdir)); // print_r($result); return $result; }

  2、打開phpcmsmodulescontentclasses目錄中的url.class.php,找到

  if (!$setting['ishtml']) { //如果不生成靜態(tài)

  將下面的:

  $url = str_replace(array('{$catid}', '{$page}'), array($catid, $page), $urlrule); if (strpos($urls, '')!==false) { $url = APP_PATH.str_replace('', '/', $urls); }

  替換成:

  $domain_dir = ''; if (strpos($category['url'], '://')!==false && strpos($category['url'], '?')===false) { if (preg_match('/^((http|https)://)?([^/]+)/i', $category['url'], $matches)) { $match_url = $matches[0]; $url = $match_url.'/'; } $db = pc_base::load_model('category_model'); $r = $db->get_one(array('url'=>$url), '`catid`'); if($r) $domain_dir = $this->get_categorydir($r['catid']).$this->categorys[$r['catid']]['catdir'].'/'; } $categorydir = $this->get_categorydir($catid); $catdir = $category['catdir']; $year = date('Y',$time); $month = date('m',$time); $day = date('d',$time); //echo $catdir; $urls = str_replace(array('{$categorydir}','{$catdir}','{$year}','{$month}','{$day}','{$catid}','{$id}','{$prefix}','{$page}'),array($categorydir,$catdir,$year,$month,$day,$catid,$id,$prefix,$page),$urlrule); // echo $urls."<br>"; if (strpos($urls, '')!==false) { $urls = APP_PATH.str_replace('', '/', $urls); } $url = $domain_dir.$urls;

  3、后臺(tái)URL規(guī)則中添加:

  url示例:1/ url規(guī)則:{$categorydir}{$catdir}/|{$categorydir}{$catdir}/{$page}/

  更新欄目緩存就OK了。

 

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多