迅睿CMS框架是一款PHP8高性能·简单易用的CMS开源开发框架,基于MIT开源许可协议发布,免费且不限制商业使用,是免费开源的产品,以万端互联为设计理念,支持的微信公众号、小程序、APP客户端、移动端网站、PC网站等多终端式管理系统。
联系官方销售客服
1835022288
028-61286886
请大佬们指点一下:
开发插件的时候,像这种的表单,是在哪里自定义的呢 ?现在就是想自己调配一些表单!
然后, 我看源码里只是这样写的:
那这个变量是在哪里定义的呢 ?
还是说,是自己在后台手动创建的表单 ?
如果是那样,那开发插件的时候如何插入这些表单呢 ?
<?php namespace Phpcmf\Controllers\Admin; class Home extends \Phpcmf\App { public function index() { // $name = 'hello word'; $a=\Phpcmf\Service::L('input')->post('ceshi'); $name=\Phpcmf\Service::M('testm', 'test')->find(); // 将变量传入模板 \Phpcmf\Service::V()->assign([ 'testname' => $name, 'p' => $a, ]); // 选择输出模板 前台位于 /template/pc/default/home/myapp/test.html 这个文件要自己手动创建 \Phpcmf\Service::V()->display('test.html'); } }
<form action="" class="form-horizontal" method="post" name="myform" id="myform"> {dr_form_hidden()} {$form} <div class="row myfbody"> <div class="col-md-12"> <div class="portlet light bordered"> <div class="portlet-title"> <div class="caption"> <span class="caption-subject font-green sbold ">{dr_lang('内容')}</span> </div> <div class="actions"> <div class="btn-group"> <a class="btn" href="{$reply_url}"> <i class="fa fa-mail-reply"></i> {dr_lang('返回列表')}</a> </div> </div> </div> <div class="portlet-body"> <div class="form-body"> <p>----title----</p> <?php echo dr_fieldform( '{ "name":"测试", "fieldname":"ceshi", "ismain":"1", "fieldtype":"Text", "setting":{ "option":{"fieldtype":"","fieldlength":"","value":"","width":"300","css":"" }, "validate":{ "required":"0","pattern":"","errortips":"","check":"","filter":"","formattr":"","tips":"输入测试文字"} }, "ismember":"1" }', $ceshi); ?> <p>----content----</p> <?php echo dr_fieldform('{"name":"测试","fieldname":"ceshi","ismain":"1","fieldtype":"Text","setting":{"option":{"fieldtype":"","fieldlength":"","value":"","width":"300","css":""},"validate":{"required":"0","pattern":"","errortips":"","check":"","filter":"","formattr":"","tips":"输入测试文字"}},"ismember":"1"}', $ceshi);?> </div> </div> </div> </div> </div> <div class="portlet-body form myfooter"> <div class="form-actions text-center"> <label><button type="button" onclick="dr_ajax_submit('{dr_now_url()}', 'myform', '2000')" class="btn green"> <i class="fa fa-save"></i> {dr_lang('保存内容')}</button></label> <label><button type="button" onclick="dr_ajax_submit('{dr_now_url()}', 'myform', '2000', '{$reply_url}')" class="btn yellow"> <i class="fa fa-mail-reply-all"></i> {dr_lang('保存并返回')}</button></label> </div> </div> </form>
方便的很啊,我开发插件都用他呢
if ($data['type'] == 'text') { $data['value'] = $data['text']; }else if($data['type'] == 'textarea'){ $data['value'] = $data['textarea']; }else if($data['type'] == 'image'){ $data['value'] = \Phpcmf\Service::M()->db->table('attachment_data')->select('attachment')->where('id',$data['image'])->get()->getRowArray(); if($image_map['attachment'] != ""){ $data['value'] = 'uploadfile/'.$image_map['attachment'];//SITE_URL. } }else if($data['type'] == 'ueditor'){ $data['value'] = $data['ueditor']; }else{ $this->_json(0, dr_lang('没有选择类型')); } //记录数据表 $rt = \Phpcmf\Service::M()->table('123')->insert([ 'type' => $data['type'], 'key' => $data['key'], 'remark' => $data['remark'], 'value' => $data['value'], ]); !$rt['code'] && $this->_json(0, $rt['msg']);//失败 $this->_json(1, dr_lang('操作成功'));//成功 }