Cms技巧
分享创造价值 合作实现共赢

Cms技巧

当前位置: 首页 > 新闻动态 > Cms技巧

phpcms V9手机门户模块实现单页功能的例子

发布时间:2019-12-16 11:13:58作者:admin点击:

第一步:实现分类管理可以绑定单页的修改办法

需要修改的文件所在目录:\phpcms\modules\wap\templates ,目录下文件type_manage.tpl.php为手机门户分类管理的模版,其中,第9行



修改为

另,\phpcms\modules\wap目录下,wap_admin.php文件的

修改type_manage方法的111行左右:


$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);

修改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);

然后再试试能否绑定单页。

第二步:实现page页面的调用方法

\phpcms\modules\wap目录下,index.php文件增加方法:


//单页 by ZRT 2016.6
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('info_does_not_exists'),'blank');
extract($data);
include template('wap', 'page');
}

第三步:wap模版目录下增加page.html模版

page.html模版中的标题使用标签{$time},内容使用{$content},与pc版相同。

第四步:调用URL

http://m.111cn.net /index.php?&a=page&typeid=12

TOP

QQ客服

18910140161