phpcms v9手机站单页面简单二次开发(直接调用单页面内容)
用于phpcms v9手机站不支持单页面的调用,所以咱们需要简单的开发一个控制器 ,通过这个控制器直接调用pc站单页面的内容。
(1)打开phpcmsmoduleswapindex.php,第283行以后增加控制器函数
(2)在手机模板文件夹里边(phpcmstemplatesdefaultwap)新增page.html,就行pc站调用内容一样,直接使用pc站的代码调用,比如:{$title}、{$content}等
完成!这样手机站可以直接调用内容了!
(1)打开phpcmsmoduleswapindex.php,第283行以后增加控制器函数
- //单页面
- function page() {
- $WAP = $this->wap;
- $TYPE = $this->types;
- $WAP_SETTING = string2array($WAP['setting']);
- $GLOBALS['siteid'] = max($this->siteid,1);
- $catid = intval($_GET['catid']);
- if(!$catid) exit(L('parameter_error'));
- $this->page_db = pc_base::load_model('page_model');
- $data = $this->page_db->get_one(array('catid'=>$catid));
- if(!$data) showmessage(L('info_does_not_exists'),'blank');
- extract($data);
- include template('wap', 'page');
- }
(2)在手机模板文件夹里边(phpcmstemplatesdefaultwap)新增page.html,就行pc站调用内容一样,直接使用pc站的代码调用,比如:{$title}、{$content}等
(3)导航处调用该栏目的链接为:{WAP_SITEURL}&a=page&catid=3 (catid=3 此处直接填写pc站该栏目对应的catid即可)
- <h1>{$title}</h1>
- <div class="reaf_info">作者:{$username} 日期:{date('m-d',strtotime($inputtime))}</div>
- <div class="read_content">{$content}</div>
完成!这样手机站可以直接调用内容了!