位置:- 正文

PHPCMS 如何添加模块?(phpcms生成html)

编辑:rootadmin
PHPCMS添加模块的方法:首先创建模块目录,目录下需要创建“classes”、“functions”和“templates”目录;然后创建模块控制器类;接着加载前台模板和后台模板;最后创建数据库模型类即可。

推荐整理分享PHPCMS 如何添加模块?(phpcms生成html),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:phpcms建站教程,phpcms建站教程,phpcms如何添加两套模板,phpcms使用教程,phpcms如何添加两套模板,phpcms如何添加友情链接,phpcms如何添加友情链接,phpcms如何添加友情链接,内容如对您有帮助,希望把文章链接给更多的朋友!

PHPCMS 如何添加模块?

首先创建模块目录,目录下需要创建“classes”、“functions”和“templates”目录;

PHPCMS 如何添加模块?(phpcms生成html)

classes 为模块类库包

functions 为模块函数库包

templates 为模块模板包,通常放置含有权限控制的控制器模板,也就是后台模板。

然后创建模块控制器类;

<?phpdefined('IN_PHPCMS') or exit('No permission resources.');class mytest{function __construct(){}public function init(){$myvar = 'hello world!';echo $myvar;}public function mylist(){$myvar = 'hello world! This is an example!';echo $myvar;}}?>

接着加载前台模板和后台模板;

public function init(){$myvar = 'hello world!';echo $myvar;include template('test', 'index');}public function init(){$myvar = 'oh,i am phpcmser';echo $myvar;include $this->admin_tpl('mytest_admin_list');}

最后创建数据库模型类即可。

<?phpdefined('IN_PHPCMS') or exit('No permission resources.');pc_base::load_sys_class('model', '', 0);class test_model extends model{public function __construct(){$this->db_config = pc_base::load_config('database');$this->db_setting = 'default';$this->table_name = 'test';parent::__construct();}}?>

推荐教程:《PHPCMS教程》

本文链接地址:https://www.jiuchutong.com/zhishi/311944.html 转载请保留说明!
下一篇链接:https://www.jiuchutong.com/zhishi/311945.html
免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络