联系官方销售客服

1835022288

028-61286886

应用插件 版主:官方插件技术组
请大佬们指点一下开发插件的时候像这种的表单是在哪里自定义的呢
类型:迅睿CMS 更新时间:2021-08-25 12:57:51 表单 插件 后台
PHP程序里面

请大佬们指点一下:

开发插件的时候,像这种的表单,是在哪里自定义的呢 ?现在就是想自己调配一些表单!

 搜狗截图19年12月14日1157_2


然后, 我看源码里只是这样写的:


搜狗截图19年12月14日1158_3


那这个变量是在哪里定义的呢 ?

还是说,是自己在后台手动创建的表单 ?

如果是那样,那开发插件的时候如何插入这些表单呢 ?

回帖
  • SDK
    #1楼    SDK
    2019-12-14 12:21:12
    Chrome 0
    增加悬赏(设置悬赏)金:4元,希望大家给予帮助!
  • #2楼    迅睿框架创始人
    2019-12-14 12:26:40
    Chrome 0
    按你自己平时写php代码的习惯来写,插件没有什么限制条件,编程方式很自由,按你的方式来写
  • SDK
    #3楼    SDK
    2019-12-14 12:33:02
    Chrome 0
    回复迅睿框架创始人我想能自由的调用官方里边的一些表单,比如单选、多选、上传等这些,,一个是能和整个系统统一,再就是,如果自己再做有点麻烦啊,,怎么样才能调用到呢 ?
  • SDK
    #4楼    SDK
    2019-12-14 12:51:21
    Chrome 0
    谁能帮写个demo?
  • SDK
    #5楼    SDK
    2019-12-14 12:53:22
    Chrome 0
    增加悬赏(设置悬赏)金:41元,希望大家给予帮助!
  • 坤哥
    #6楼    坤哥
    2019-12-14 13:24:12
    Chrome 0
    \Phpcmf\Service::V()->assign("myfield", "这里是控制器定义的变量,在模板中输出就行");
  • 易学习
    #7楼    易学习
    2019-12-14 13:26:12
    Chrome 0
    调用官方里边的一些表单,比如单选、多选、上传等这些,下载一个开发者工具就行了
    image

    image
    方便的很啊,我开发插件都用他呢
    满意答案
  • 125762285
    #8楼    125762285
    2019-12-14 14:41:00
    Chrome 0
    学习学习
  • because
    #9楼    because
    2019-12-14 14:44:49
    Chrome 0
    大概这样吧<?php $field = [ 'type' => [ 'ismain' => 1, 'fieldtype' => 'Select', 'fieldname' => 'type', 'setting' => ['option' =>["options"=>"单行文本|text\n多行文本|textarea\n图片|image\n编辑器|ueditor\n","value"=>"","fieldtype"=>"","fieldlength"=>'',"css"=>""],"validate" =>["required"=>"0","pattern"=>"","errortips"=>"","check"=>"","filter"=>"","formattr"=>"","tips"=>""],"is_right"=>"0"], ], 'text' => [ 'ismain' => 1, 'fieldtype' => 'Text', 'fieldname' => 'text', 'setting' => ['option' =>["width"=>400,"fieldtype"=>"VARCHAR","fieldlength"=>255],"validate" =>['required'=>'1','formattr'=>'onblur=\"check_title();get_keywords(\'keywords\');\"']], ], 'textarea' => [ 'ismain' => 1, 'fieldtype' => 'Textarea', 'fieldname' => 'textarea', 'setting' => ['option' =>["width"=>500,"height"=>60,"fieldtype"=>"VARCHAR","fieldlength"=>255],"validate" =>['filter'=>'dr_clearhtml']], ], 'image' => [ 'ismain' => 1, 'fieldtype' => 'File', 'fieldname' => 'image', 'setting' => ['option' => ['ext' => 'jpg,gif,png,jpeg', 'size' => 10, 'input' => 1]] ], 'ueditor' => [ 'ismain' => 1, 'fieldtype' => 'Ueditor', 'fieldname' => 'ueditor', 'setting' => ['option' =>["mode"=>"1","width"=>"100%","height"=>400],"validate" =>['required'=>'1']], ] ]; \Phpcmf\Service::V()->assign([ 'type' => dr_fieldform($field['type']), 'text' => dr_fieldform($field['text']), 'textarea' => dr_fieldform($field['textarea']), 'ueditor' => dr_fieldform($field['ueditor']), 'image' => dr_fieldform($field['image']), ]); \Phpcmf\Service::V()->display('123.html');?><div class="form-group"> <label class="col-md-2 control-label">{dr_lang('类型')}</label> <div class="col-md-9"> {$type} </div></div><div class="form-group dn" name="text"> <label class="col-md-2 control-label">{dr_lang('内容')}</label> <div class="col-md-9"> {$text} </div></div><div class="form-group dn" name="textarea"> <label class="col-md-2 control-label">{dr_lang('内容')}</label> <div class="col-md-9"> {$textarea} </div></div><div class="form-group dn" name="image"> <label class="col-md-2 control-label">{dr_lang('内容')}</label> <div class="col-md-9"> {$image} </div></div><div class="form-group dn" name="ueditor"> <label class="col-md-2 control-label">{dr_lang('内容')}</label> <div class="col-md-9"> {$ueditor} </div></div>
  • SDK
    #10楼    SDK
    2019-12-14 16:05:12
    Chrome 0
    易学习大神,按照你这个方法,为什么我得不到表单post过来的值呢 ?这是PHP
    <?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>
    这是后台界面,提示系统崩溃~~!!?
    搜狗截图19年12月14日1604_4
  • SDK
    #11楼    SDK
    2019-12-14 16:07:12
    Chrome 0
    because 你这个怎么获取表单post过来 的值啊 ?
  • because
    #12楼    because
    2019-12-14 16:19:47
    Chrome 0
    SDKif (IS_AJAX_POST) {//判断post $data = \Phpcmf\Service::L('input')->post('data', false);//获取内容 //对应处理
    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('操作成功'));//成功 }
  • SDK
    #13楼    SDK
    2021-08-25 12:57:51
    Chrome 0
    @易学习:xieixie 谢谢 感谢