邓_phpcms_二次开发_留言板

邓_phpcms_二次开发_留言板_第1张图片

=================================================================

•在 phpcms/modules 目录下创建文件夹,并将其命名为guestbook
 
classes  为模块类库包
functions 为模块函数库包
templates 为模块模板包 这里通常放置含有权限控制的控制器模板,也就是后台模板。
Install
Uninstall
Index.php
Guestbook.php
如果您的模块有单独的前台模版,你需要在phpcms/templates/default下创建一个您的模块同名目录来放置前台模板,“default”为你的风格包名称,我们默认适用default。
 --------------------------------------------------------------------------------------------
•添加外链栏目,指向记事本的控制器
•添加add.html模板,添加留言
•显示留言以及回复
 --------------------------------------------------------------------------------------------
•Config.inc.php

defined('IN_PHPCMS') or exit('Access Denied');
defined('INSTALL') or exit('Access Denied');
$module = 'guestbook';
$modulename = '留言板';
$introduce = '留言模块';
$author = '个人团队';
$authorsite = 'http://www.phpcms.cn';
$authoremail = '';

?>

 ---------------------------------------------------------------------------------------------
路径:phpcms/modules/guestbook/install/extention.inc.php

//是否在后台主导航条上
$guestbook=$menu_db->get_one(array('name'=>'guestbook','parentid'=>'0'));
if($guestbook)
{
$parentid=$guestbook['id'];
}
else
{
$parentid=$menu_db->insert(
array(
'name'=>'a1',
'parentid'=>0,
'm'=>'guestbook',
'c'=>'index',
'a'=>'init',
'data'=>'',
'listorder'=>'10',
'display'=>'1'
),true);
}

//左侧主菜单
$id=$menu_db->insert(
array(
'name'=>'a2',
'parentid'=>$parentid,
'm'=>'guestbook',
'c'=>'guestbook',
'a'=>'init',
'data'=>'',
'listorder'=>'1',
'display'=>'1'
),true);
//左侧菜单项
$idd=$menu_db->insert(
array(
'name'=>'a3',
'parentid'=>$id,
'm'=>'guestbook',
'c'=>'guestbook',
'a'=>'guestbook_list',
'data'=>'',
'listorder'=>'1',
'display'=>'1'
),true);

$language =array(
'a1'=>'留言板',
'a2'=>'留言板',
'a3'=>'留言列表'
);


?>

 -----------------------------------------------------------
添加模块module.sql
 
路径:phpcms/modules/guestbook/install/module.php
 

INSERT INTO `phpcms_module` VALUES ('guestbook', '留言板', '', '0', '1.0', '', 'array (\n 1 => \n array (\n \'is_post\' => \'1\',\n \'enablecheckcode\' => \'0\',\n ),\n)', '0', '0', '2010-09-06', '2010-09-06');

----------------------------------------------------------------------------------------
建表guestbook.sql
路径:phpcms/modules/guestbook/install/guestbook.sql
 
DROP TABLE IF EXISTS `v9_guestbook`;
CREATE TABLE `v9_guestbook` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`content` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`author` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`cellphone` VARCHAR( 15 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`qq` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`email` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`msn` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`addtime` INT NULL ,
`ip` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`reply_admin` VARCHAR( 200 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`reply_content` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,
`reply_time` INT NULL ,
`status` INT NULL DEFAULT '-1')
 ENGINE = MYISAM ;
 
insert into v9_guestbook(title,content,author,cellphone) values
('ss','tt','admin','122'),
('jjj','hh','admin','120'),
('ggg','nnnn','admin','133');
 -----------------------------------------------------------------------
Uninstall卸载
 
路径:phpcms/modules/guestbook/uninstall
•model.php
•extension.inc.php
•guestbook.sql
 
--------------------------------------------------------------------------
后台控制器guestbook.php
路径:phpcms/modules/guestbook/guestbook.php

defined('IN_PHPCMS') or exit('No permission resources.');
pc_base::load_app_class('admin','admin',0);
class guestbook extends admin {
function __construct() {
parent::__construct();
$this->db = pc_base::load_model('guestbook_model');
}
public function guestbook_list()
{
$infos=$this->db->select();
include $this->admin_tpl('guestbook_list');
}
public function guestbook_edit()
{
}
public functionguestbook_del()
{
}
}

?>

------------------------------------------------------------------

后台模板guestbook_list.tpl.php
路径:phpcms/modules/guestbook/
•include $this->admin_tpl('header', 'admin');
-----------------------------------------------------------------
搜索部分













标题:
姓名:
手机:
QQ:


 ---------------------------------------------------
guestbook/install/model.php

defined('IN_PHPCMS') or exit('Access Denied');
defined('INSTALL') or exit('Access Denied');
return array('guestbook');
?>

 
 
------------------------------
 
 

转载于:https://www.cnblogs.com/vip-deng-vip/p/7299725.html

你可能感兴趣的:(邓_phpcms_二次开发_留言板)