phpcms v9手机站单页面简单二次开发(直接调用单页面内容)

用于phpcms v9手机站不支持单页面的调用,所以咱们需要简单的开发一个控制器 ,通过这个控制器直接调用pc站单页面的内容。
(1)打开phpcmsmoduleswapindex.php,第283行以后增加控制器函数
  1. //单页面 
  2.     function page() { 
  3.         $WAP = $this->wap; 
  4.         $TYPE = $this->types; 
  5.         $WAP_SETTING = string2array($WAP['setting']);    
  6.         $GLOBALS['siteid'] = max($this->siteid,1);   
  7.         $catid = intval($_GET['catid']);         
  8.         if(!$catid) exit(L('parameter_error'));                  
  9.  
  10.         $this->page_db = pc_base::load_model('page_model'); 
  11.         $data = $this->page_db->get_one(array('catid'=>$catid)); 
  12.         if(!$data) showmessage(L('info_does_not_exists'),'blank'); 
  13.         extract($data); 
  14.         include template('wap''page'); 
  15.     } 

(2)在手机模板文件夹里边(phpcmstemplatesdefaultwap)新增page.html,就行pc站调用内容一样,直接使用pc站的代码调用,比如:{$title}、{$content}等
  1. <h1>{$title}</h1> 
  2. <div class="reaf_info">作者:{$username}&nbsp;&nbsp;日期:{date('m-d',strtotime($inputtime))}</div> 
  3. <div class="read_content">{$content}</div> 
(3)导航处调用该栏目的链接为:{WAP_SITEURL}&a=page&catid=3  (catid=3 此处直接填写pc站该栏目对应的catid即可)

完成!这样手机站可以直接调用内容了!





本文关键词:

联系我们

在线咨询:点击这里给我发消息

邮件:w420220301@qq.com