国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > PhpCMS > 正文

PHPCMS二次開發(fā)wap手機(jī)站創(chuàng)建tags列表頁及調(diào)用教程

2024-09-10 07:17:22
字體:
供稿:網(wǎng)友
這篇文章主要為大家詳細(xì)介紹了PHPCMS二次開發(fā)wap手機(jī)站創(chuàng)建tags列表頁及調(diào)用教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下,有需要的朋友可以收藏方便以后借鑒。

本文是361源碼今天早上起床后看到的一篇文章,感覺有參考價(jià)值,就轉(zhuǎn)載過來了,如有版權(quán),請(qǐng)聯(lián)系本站處理。

PHPCMS二次開發(fā)wap手機(jī)站創(chuàng)建tags列表頁及調(diào)用教程

用PHPCMS創(chuàng)建了PC站的tags匯總頁和列表頁,通過統(tǒng)計(jì)觀察效果還不錯(cuò),有不少人訪問,因此想在移動(dòng)端手機(jī)站上也創(chuàng)建tags匯總頁和列表頁,可是默認(rèn)只能在 /phpcms/templates/default/content 創(chuàng)建一個(gè)tag.html和tag_list.html頁面,在PC端用了移動(dòng)端就用不了了,361源碼網(wǎng)站長思考了下,能不能在移動(dòng)端 /phpcms/templates/default/wap 目錄下也創(chuàng)建一個(gè)tag.html和tag_list.html 頁面來實(shí)現(xiàn)呢?下面就是武林網(wǎng)站長的實(shí)現(xiàn)方法,希望對(duì)有需要的朋友有所幫助。

1、將 /phpcms/modules/content/tag.php 文件拷貝到 /phpcms/modules/wap 目錄下

2、打 /phpcms/modules/wap/tag.php 文件

2.1、將 pc_base::load_app_func('util','content'); 注釋或刪除,并在原位置添加 pc_base::load_app_func('global');

2.2、將 __construct() 函數(shù)中 $this->siteid = get_siteid(); 注釋或刪除,并在原位置下邊添加

$this->siteid = isset($_GET['siteid']) && (intval($_GET['siteid']) > 0) ? intval(trim($_GET['siteid'])) : (param::get_cookie('siteid') ? param::get_cookie('siteid') : 1);param::set_cookie('siteid',$this->siteid);    $this->wap_site = getcache('wap_site','wap');$this->types = getcache('wap_type','wap');$this->wap = $this->wap_site[$this->siteid];define('WAP_SITEURL', $this->wap['domain'] ? $this->wap['domain'].'index.php?' : APP_PATH.'index.php?m=wap&siteid='.$this->siteid);if($this->wap['status']!=1) exit(L('wap_close_status'));

2.3、將 include template('content', 'tag'); 修改為 include template('wap', 'tag');

2.4、找到 $res = $this->db->get_one(array('id'=>$contentid), 'title, description, url, inputtime, style'); 

修改為

$res = $this->db->get_one(array('id'=>$contentid), 'catid, title, description, inputtime, style');

此步驟添加 catid, 并刪除 url,

2.5、找到 $res['description'] = str_replace($tag, '<font color="#f00">'.$tag.'</font>', $res['description']); 并在此代碼下邊添加

$catid = $res['catid'];$types = getcache('wap_type','wap');foreach ($types as $type) {    if($type['cat']==$catid) {    $typeid = $type['typeid'];    break;    }}$res['url'] = WAP_SITEURL."&a=show&catid=".$catid."&typeid=".$typeid."&id=".$contentid;

2.6、將 include template('content','tag_list'); 修改為 include template('wap','tag_list');

2.7、如想看完整文件請(qǐng)?jiān)谖恼伦钕逻吙?/p>

3、文章內(nèi)容頁調(diào)用示例:

{loop $keywords $keyword}<a title="www.survivalescaperooms.com" href="{WAP_SITEURL}m=wap&c=tag&a=lists&tag={urlencode($keyword)}">{$keyword}</a>{/loop}

4、在 /phpcms/templates/default/wap 目錄下創(chuàng)建 tag.html 即為tags匯總頁 tag_list.html 即為tags列表頁

5、tag.html調(diào)用標(biāo)簽示例:

{loop $infos $info}  <p><a title="www.survivalescaperooms.com" href="{WAP_SITEURL}m=wap&c=tag&a=lists&tag={urlencode($info['keyword'])}">{$info['keyword']}</a>({$info['videonum']})</p>{/loop}

6、tag_list.html調(diào)用標(biāo)簽示例:

<div>  <ul>{loop $datas $r}    <li><span class="www.survivalescaperooms.com">{date('Y-m-d H:i:s',$r[inputtime])}</span>·<a href="{$r[url]}" title="www.survivalescaperooms.com" target="_blank">{$r[title]}</a></li>{/loop}  </ul>  <div id="pages">{$pages}</div></div>

7、/phpcms/modules/wap/tag.php 文件完整展示

<?php/* * * PHPCMS V9二次開發(fā)之wap手機(jī)站創(chuàng)建tags匯總頁(tag.html)列表頁(tag_list.html) * 此文章由武林網(wǎng)(www.survivalescaperooms.com)創(chuàng)作,轉(zhuǎn)載請(qǐng)注明版權(quán) * */defined('IN_PHPCMS') or exit('No permission resources.');//模型緩存路徑define('CACHE_MODEL_PATH',CACHE_PATH.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR);//此處將 pc_base::load_app_func('util','content'); 刪除,并在原位置添加 pc_base::load_app_func('global');pc_base::load_app_func('global');class tag {    private $db;    function __construct() {        $this->db = pc_base::load_model('content_model');        $this->keyword_db = pc_base::load_model('keyword_model');        //此處將 $this->siteid = get_siteid(); 刪除并添加如下代碼,直到此函數(shù)最后        $this->siteid = isset($_GET['siteid']) && (intval($_GET['siteid']) > 0) ? intval(trim($_GET['siteid'])) : (param::get_cookie('siteid') ? param::get_cookie('siteid') : 1);        param::set_cookie('siteid',$this->siteid);            $this->wap_site = getcache('wap_site','wap');        $this->types = getcache('wap_type','wap');        $this->wap = $this->wap_site[$this->siteid];        define('WAP_SITEURL', $this->wap['domain'] ? $this->wap['domain'].'index.php?' : APP_PATH.'index.php?m=wap&siteid='.$this->siteid);        if($this->wap['status']!=1) exit(L('wap_close_status'));    }        public function init() {        $page = max($_GET['page'], 1);        $pagesize = 20;        $where = '`siteid`='.$this->siteid;        $infos = $this->keyword_db->listinfo($where, '`searchnums` DESC, `videonum` DESC', $page, $pagesize);        $pages = $this->keyword_db->pages;        //將原模板路徑 content 修改為新手機(jī)模板路徑 wap        include template('wap', 'tag');    }    /**     * 按照模型搜索     */    public function lists() {        $tag = safe_replace(addslashes($_GET['tag']));        $keyword_data_db = pc_base::load_model('keyword_data_model');        //獲取標(biāo)簽id        $r = $this->keyword_db->get_one(array('keyword'=>$tag, 'siteid'=>$this->siteid), 'id');        if (!$r['id']) showmessage('不存在此關(guān)鍵字!');        $tagid = intval($r['id']);        $page = max($_GET['page'], 1);        $pagesize = 20;        $where = '`tagid`=/''.$tagid.'/' AND `siteid`='.$this->siteid;        $infos = $keyword_data_db->listinfo($where, '`id` DESC', $page, $pagesize);        $pages = $keyword_data_db->pages;        $total = $keyword_data_db->number;        if (is_array($infos)) {            $datas = array();            foreach ($infos as $info) {                list($contentid, $modelid) = explode('-', $info['contentid']);                $this->db->set_model($modelid);                //下行代碼添加 catid, 并刪除 url,                $res = $this->db->get_one(array('id'=>$contentid), 'catid, title, description, inputtime, style');                $res['title'] = str_replace($tag, '<font color="#f00">'.$tag.'</font>', $res['title']);                $res['description'] = str_replace($tag, '<font color="#f00">'.$tag.'</font>', $res['description']);                //此處為武林網(wǎng)(www.survivalescaperooms.com)添加代碼開始                $catid = $res['catid'];                $types = getcache('wap_type','wap');                foreach ($types as $type) {                    if($type['cat']==$catid) {                    $typeid = $type['typeid'];                    break;                    }                }                $res['url'] = WAP_SITEURL."&a=show&catid=".$catid."&typeid=".$typeid."&id=".$contentid;                //此處為武林網(wǎng)(www.survivalescaperooms.com)添加代碼結(jié)束                $datas[] = $res;            }        }        $SEO = seo($siteid, '', $tag);        //將原模板路徑 content 修改為新手機(jī)模板路徑 wap        include template('wap','tag_list');    }}?>

轉(zhuǎn)載完畢,代碼361源碼沒有親測,有興趣的朋友可以自行測試,如果有問題請(qǐng)向我們反映。

以上就是PHPCMS二次開發(fā)wap手機(jī)站創(chuàng)建tags列表頁及調(diào)用教程的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)和解決疑問有所幫助,也希望大家多多支持武林網(wǎng)。
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 湘西| 图木舒克市| 司法| 吴川市| 山阴县| 太和县| 三江| 禹州市| 余庆县| SHOW| 抚州市| 治县。| 宜章县| 海口市| 论坛| 运城市| 奉贤区| 莲花县| SHOW| 奉节县| 柯坪县| 车险| 崇礼县| 江都市| 澎湖县| 文安县| 临夏县| 育儿| 闽清县| 凤翔县| 郴州市| 贵阳市| 肃北| 亳州市| 利川市| 石林| 宁蒗| 龙州县| 格尔木市| 石屏县| 巴林右旗|