评论内容不能为空,请问怎么解决
show.html 使用的 问答插件复制过来的评论方式,然后看到论坛有回答说替换以下代码
<?php echo dr_field_form([
                          'name' => '内容',
                        'ismain' => 1,
                        'fieldtype' => 'Ueditor',
                        'fieldname' => 'content',
                        'setting' => array('option' => array( 'mode' => 3, 'height' => 220, 'width' => '100%', 'tool' => IS_PC ? '\'undo\', \'bold\', \'forecolor\',\'simpleupload\', \'attachment\', \'insertimage\', \'insertcode\'' : '\'undo\', \'bold\', \'image\''), 'validate' => array('xss' => 1))
                        ]);
                        ?>不知道怎么替换为 textarea
<div id="commentlist" class="page-content"> <div class="boxedtitle page-title"><h2>回帖 ( <span class="color">{$comments}</span> )</h2></div> <ol class="commentlist clearfix" id="dr_module_comment_{$id}"> {php $ajax_pages=$comment_pages;} {php $list=$comment_list;} {template "comment_ajax.html"} </ol> {if $is_comment != 1} <form action="" method="post" id="myform_comment" class="comment-form"> {dr_form_hidden()} <input type="hidden" name="is_ajax" value="1"> <input type="hidden" name="catid" value="{$catid}"> <div id="respond-textarea"> <?php echo dr_field_form([ 'name' => '内容', 'ismain' => 1, 'fieldtype' => 'Ueditor', 'fieldname' => 'content', 'setting' => array('option' => array( 'mode' => 3, 'height' => 220, 'width' => '100%', 'tool' => IS_PC ? '\'undo\', \'bold\', \'forecolor\',\'simpleupload\', \'attachment\', \'insertimage\', \'insertcode\'' : '\'undo\', \'bold\', \'image\''), 'validate' => array('xss' => 1)) ]); ?> </div> <p class="form-submit" style="margin-top: 10px;"> <button class="color button dark_button medium" id="comment_submit" onclick="dr_post_comment()" type="button">回复帖子</button> </p> </form> {/if} </div>此代码在回复的时候提示评论内容不能为空<?php namespace Phpcmf\Model\Article; // 模块内容模型类 class Content extends \Phpcmf\Model\Content { // 格式化显示内容,用于前端内容详情页面的格式化 public function _call_show($data) { $cache = \Phpcmf\Service::L('cache')->get('app-comment-'.SITE_ID, 'module', MOD_DIR); if (!$cache) { return $data; } elseif (!$cache['use']) { return $data; } if (!isset($cache['order']) || !$cache['order']) { $cache['order'] = 'inputtime desc'; } $page = max(1, (int)\Phpcmf\Service::L('input')->get('page')); if (IS_API_HTTP) { $pagesize = (int)$cache['pagesize_api']; } elseif (\Phpcmf\Service::IS_MOBILE()) { $pagesize = (int)$cache['pagesize_mobile']; } else { $pagesize = (int)$cache['pagesize']; } !$pagesize && $pagesize = 10; // 查询数据 list($list, $total) = $this->get_comment_result($data['id'], $cache['order'], $page, $pagesize, 0, $cache['field']); $data['comment_list'] = $list; $data['comment_pages'] = $this->_get_pages(\Phpcmf\Service::L('Router')->show_url(\Phpcmf\Service::C()->module, $data, '{page}'), $total, $pagesize); $data['comment_cache'] = $cache; return $data; } /** * 评论ajax分页 方便二次开发和重写 */ protected function _get_pages($url, $total, $pagesize) { $config = []; $file = 'config/page/'.(\Phpcmf\Service::IS_PC() ? 'pc' : 'mobile').'/ajax.php'; if (is_file(WEBPATH.$file)) { $config = require WEBPATH.$file; } elseif (is_file(ROOTPATH.$file)) { $config = require ROOTPATH.$file; } else { $config['next_link'] = '>'; $config['prev_link'] = '<'; $config['last_link'] = '>|'; $config['first_link'] = '|<'; $config['cur_tag_open'] = '<a class="ds-current">'; $config['cur_tag_close'] = '</a>'; } $config['base_url'] = $url; $config['per_page'] = $pagesize; $config['total_rows'] = $total; $config['use_page_numbers'] = TRUE; $config['query_string_segment'] = 'page'; return \Phpcmf\Service::L('Page')->initialize($config)->create_links(); } public function author_url($uid) { $urlrule = \Phpcmf\Service::C()->get_cache('module-'.SITE_ID.'-article', 'setting', 'param', 'user', 'urlrule'); if ($urlrule) { return dr_url_prefix(str_replace('{id}', $uid, $urlrule), 'article'); } return '/index.php?s=article&c=user&uid='.$uid; } public function cache($siteid = SITE_ID) { $table = $this->prefix.$siteid.'_article_comment'; if ($this->db->tableExists($table)) { if (!$this->db->fieldExists('zuijiadaan', $table)) { $this->query_all('ALTER TABLE `{dbprefix}'.SITE_ID.'_article_comment` ADD `zuijiadaan` INT(10) NULL;'); } // 遗漏的字段 if (!$this->table('field')->where('relatedname', 'comment-module-article')->where('fieldname','zuijiadaan')->counts()) { $this->query_sql('INSERT INTO `{dbprefix}field` (`id`, `name`, `fieldname`, `fieldtype`, `relatedid`, `relatedname`, `isedit`, `ismain`, `issystem`, `ismember`, `issearch`, `disabled`, `setting`, `displayorder`) VALUES (null, \'最佳答案\', \'zuijiadaan\', \'Text\', 0, \'comment-module-article\', 1, 1, 0, 0, 0, 0, \'{"option":{"fieldtype":"","fieldlength":"","value":"","width":"","css":""},"validate":{"required":"0","pattern":"","errortips":"","check":"","filter":"","formattr":"","tips":""},"is_right":"0"}\', 0); '); } } } }