phpcms手机版怎么绑定单页面。phpcms在手机版这方面做的比较简洁,想同步手机版的单页面和PC端,要怎么修改源码呢,第一步
打开文件\phpcms\modules\wap\templates\type_manage.tpl.php
echo form::select_category('category_content_'.$siteid,$parentid,'name="info[cat]"',L('wap_type_bound'),0,0,0,$siteid); 修改为 echo form::select_category('category_content_'.$siteid,$parentid,'name="info[cat]"',L('wap_type_bound'),0,-1,0,$siteid);
第二步打开\phpcms\modules\wap\wap_admin.php
$r['select_cat'] = form::select_category('',$r[cat],'name="cat['.$r['typeid'].']"',L('wap_type_bound'),0,0,0,$siteid); 改为 $r['select_cat'] = form::select_category('',$r[cat],'name="cat['.$r['typeid'].']"',L('wap_type_bound'),0,-1,0,$siteid);
第三步也是\phpcms\modules\wap\wap_admin.php 这个文件夹
修改public_show_cat_ajx方法
echo form::select_category('',0,'name="addcat['.$parentid.'][]"',L('wap_type_bound'),0,0,0,$siteid); 修改为 echo form::select_category('',0,'name="addcat['.$parentid.'][]"',L('wap_type_bound'),0,-1,0,$siteid);
最后一步 在\phpcms\modules\wap\index.php增加函数
function page() { $WAP = $this->wap; $TYPE = $this->types; $WAP_SETTING = string2array($WAP['setting']); $GLOBALS['siteid'] = max($this->siteid,1); $typeid = intval($_GET['typeid']); if(!$typeid) exit(L('parameter_error')); $catid = $this->types[$typeid]['cat']; $tablename = $this->db->table_name = $this->db->db_tablepre."page"; $data = $this->db->get_one(array('catid'=>$catid)); if(!$data) showmessage(L('error'),'blank'); extract($data); include template('wap', 'page'); }
然后更新系统缓存试试,进入手机模块
添加绑定文件,通过域名测试index.php?m=wap&siteid=1&a=page&typeid=6
测试ok。教程结束
注意是下面4个文件
小编打包好了要修改的4和文件和整个wap文件夹,覆盖即可