<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                插件后臺編寫其實是固定套路寫法 cmf在初次激活插件的時候就已經有了幾個按鈕 如圖所示 ![](https://box.kancloud.cn/514769e80cce87a8bf8f154adb8a22d1_1594x51.png) 這個按鈕的鏈接直接指向到了AdminIndexController(固定名稱),這個控制器里面咱們可以隨便指向到任意模板了 我們要實現的是 后臺留言列表頁 后臺留言詳情頁 刪除功能 * * * * * 文件結構 │ config.php │ GuestbookPlugin.php │ ├─assets │ └─css │ sy.guestbook.css │ ├─controller │ AdminIndexController.php(新增) │ IndexController.php │ ├─data │ config.php │ guestbook.sql │ ├─model │ PluginSyGuestbookModel.php │ ├─validate │ GuestbookValidate.php │ └─view │ admin_detail.html(新增) │ admin_index.html(新增) │ css.html │ js.html │ widget.html │ └─public head.html(新增) scripts.html(新增) * * * * * admin_index.html ~~~ <!doctype html> <html> <head> <include file="public/head"/> <title>留言板后臺管理</title> <meta name="description" content=""> <meta name="keywords" content=""> </head> <body> <div class="wrap js-check-wrap"> <ul class="nav nav-tabs"> <li class="active"><a>留言板管理</a></li> </ul> <div class="common-form"> <form method="post" class="js-ajax-form" action="#"> <div class="table_list"> <table width="100%" class="table table-hover"> <thead> <tr> <th width="50">ID</th> <th width="100">姓名</th> <th width="130">時間</th> <th width="120">操作</th> </tr> </thead> <tbody> <foreach name="guestbook" item="vo"> <tr> <td>{$vo.id}</td> <td>{$vo.name}</td> <td>{:date('Y-m-d H:i',$vo['create_time'])}</td> <td> <a href="javascript:parent.openIframeLayer('{:cmf_plugin_url('Guestbook://AdminIndex/detail',['id'=>$vo['id']])}','{$vo.name}的留言詳細信息',{area:['60%','70%']});">查看</a> | <a href="{:cmf_plugin_url('Guestbook://AdminIndex/delete',['id'=>$vo['id']])};" class="js-ajax-delete">刪除</a> </td> </tr> </foreach> </tbody> </table> <div class="pagination">{$page}</div> </div> </form> </div> </div> <include file="public/scripts"/> </body> </html> ~~~ admin_detail.html ~~~ <!doctype html> <html> <head> <include file="public/head"/> <title>留言板后臺管理</title> <meta name="description" content=""> <meta name="keywords" content=""> </head> <body> <div class="wrap"> <div class="guestbook-detail"> <h3>{$detail.name}的留言詳細信息 <small>{:date('Y-m-d H:i',$detail['create_time'])}</small> </h3> <table class="table table-bordered table-hover"> <tr> <td width="15%">姓名</td> <td>{$detail.name}</td> </tr> </table> </div> </div> <include file="public/scripts"/> </body> </html> ~~~ public/head.html ~~~ <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Set render engine for 360 browser --> <meta name="renderer" content="webkit"> <!-- No Baidu Siteapp--> <meta http-equiv="Cache-Control" content="no-siteapp"/> <link rel="shortcut icon" href="__PLUGIN_TMPL__/public/assets/images/favicon.ico" type="image/x-icon"> <link href="__ADMIN_TMPL__/public/assets/themes/{:cmf_get_admin_style()}/bootstrap.min.css" rel="stylesheet"> <link href="__ADMIN_TMPL__/public/assets/simpleboot3/css/simplebootadmin.css" rel="stylesheet"> <link href="__STATIC__/font-awesome/css/font-awesome.min.css?page=index" rel="stylesheet" type="text/css"> <script type="text/javascript"> //全局變量 var GV = { ROOT: "__ROOT__/", WEB_ROOT: "__WEB_ROOT__/", JS_ROOT: "static/js/" }; </script> ~~~ scripts.html ~~~ <script src="__STATIC__/js/jquery.js"></script> <script src="__STATIC__/js/wind.js"></script> <script src="__STATIC__/js/bootstrap.min.js"></script> <script src="__STATIC__/js/admin.js"></script> ~~~ controller/AdminIndexController.php ~~~ <?php namespace plugins\guestbook\controller; //Demo插件英文名,改成你的插件英文就行了 use cmf\controller\PluginBaseController; use plugins\guestbook\Model\PluginSyGuestbookModel; class AdminIndexController extends PluginBaseController { //初始化,檢測是否可以管理 function _initialize() { $adminId = cmf_get_current_admin_id();//獲取后臺管理員id,可判斷是否登錄 if (!empty($adminId)) { $this->assign("admin_id", $adminId); } else { header('HTTP/1.1 404 Not Found'); header('Status:404 Not Found'); $this->error('非法登錄!!'); } } //留言列表 function index() { $guestbookModel = new PluginSyGuestbookModel(); $guestbook = $guestbookModel->order("id DESC")->paginate(20); // 獲取分頁顯示 $page = $guestbook->render(); $this->assign("guestbook", $guestbook); $this->assign("page", $page); return $this->fetch('/admin_index'); } //查看留言詳細信息 function detail() { $id = $this->request->param('id', 0, 'intval'); $guestbookModel = new PluginSyGuestbookModel(); $detail = $guestbookModel->where(["id" => $id])->find(); $this->assign("detail", $detail); return $this->fetch('/admin_detail'); } //刪除留言 function delete() { $id = $this->request->param('id', 0, 'intval'); $guestbookModel = new PluginSyGuestbookModel(); $guestbookModel::destroy(['id' => $id]); $this->success('刪除成功!'); } } ~~~ ![](https://box.kancloud.cn/514769e80cce87a8bf8f154adb8a22d1_1594x51.png) ![](https://box.kancloud.cn/058262943432669b5bdca6d30f47ed2d_1647x225.png) ![](https://box.kancloud.cn/624cd51beb1b8ce0ba40a91c3fdbf3ff_1648x400.png) ![](https://box.kancloud.cn/b9e82a8e8955d26b5698cfd3c7e0007b_1610x326.png) ![](https://box.kancloud.cn/b96d854ab243b695b23b96fa2fd1248d_1626x234.png) > 首先感謝WelkinVan 他寫的《ThinkCMF5從入門到精通》給了我很多幫助 > 點擊去《[ThinkCMF5從入門到精通](http://www.hmoore.net/welkinvan/thinkcmf5)》 >
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看