DISCUZ 插件管理中心页面开发

插件的管理中心不需要cpheader()等输出头部尾部,直接输出需要的内容即可,也可加载模板,同样模板也不需要HTML头部尾部,因为以.inc.php的文件都是被嵌入的.

一个例子:

程序文件放在source/plugin/xxx/下

<?php//echo "欢迎来到管理中心!相关程序正在开发中......";/******************判断是否被正常引入**********************/if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {exit('Access Denied');}/*******创建二维数组$cardcategory,保存充值卡类别信息,下标是卡品ID********/$result= DB::query("SELECT * FROM ".DB::table('xxjob_cardcategory'));$cardcategory=array();while($arr=DB::fetch($result)){    $arr['date']=  dgmdate($arr['date'],'u');//将时间戳转换为距当前时长    $i=$arr['id'];    $cardcategory[$i]=$arr;}/****************当收到自动生成请求时********************/if($_POST['type']=="autocreate"){        //判断数量是否小于10000    if(intval($_POST['num'])>=10000||intval($_POST['num'])<=0){        echo "<div >模板文件如下 ,模板文件放在source/plugin/xxx/template/下

<style type="text/css">    .recharge_box{        margging:20px;    }    .recharge_box table{        width:300px;        margin:20px;    }    .recharge_box table,.recharge_box tr,.recharge_box td{        border:3px solid black;    }    .recharge_box td{        padding:10px;        text-align: center;    }    .recharge_box textarea{        width:360px;        height:400px;    }</style><div class="recharge_box">    <form action="admin.php?action=plugins&identifier=chongzhi&pmod=admin" method="post">        <table border="1" cellspacing="0">            <thead>                <tr><td>说明</td><td>操作</td></tr>            </thead>            <tbody>                <tr>                    <td>选择充值卡种类</td>                    <td>                        <select id="select" name="card_id">                            <!--{loop $cardcategory $val}-->                            <option value="{$val['id']}">{$val['name']}</option>                            <!--{/loop}-->                        </select>                    </td>                </tr>                <tr><td>生成数量(小于10000条)</td><td><input type="text" name="num" /><input type="hidden" name="type" value="autocreate" /></td></tr>                <tr><td>确认生成</td><td><input type="submit" value="生成" /></td></tr>            </tbody>        </table>    </form>    <!--{if $card_list}-->        <!--{if $create_status}-->        <div >

生活比你想象的要容易得多,只要学会接受那些不可接受的,

DISCUZ 插件管理中心页面开发

相关文章:

你感兴趣的文章:

标签云: