ECSHOP留言板添加字段虽然有点繁锁,但也不是很难,操作方法如下(本人已经实现过):步骤 1. 更改文件message_board.dwt<tr><td align="right">{$lang.message_board_qq}</td><td><i
ECSHOP留言板添加字段虽然有点繁锁,但也不是很难,操作方法如下(本人已经实现过):
步骤 1. 更改文件message_board.dwt
<tr>
<td align="right">{$lang.message_board_qq}</td>
<td><input name="msg_qq" type="text" class="inputBg" size="20" value=""/></td>
</tr>
<script type="text/javascript">
{foreach from=$lang.message_board_js item=item key=key}
var {$key} = "{$item}";
{/foreach}
{literal}
function submitMsgBoard(frm)
{
var msg = new Object;
msg.user_email = frm.elements['user_email'].value;
msg.msg_qq = frm.elements['msg_qq'].value;
msg.msg_title = frm.elements['msg_title'].value;
msg.msg_content = frm.elements['msg_content'].value;
msg.captcha = frm.elements['captcha'] ? frm.elements['captcha'].value : '';
var msg_err = '';
if (msg.user_email.length > 0)
{
if (!(Utils.isEmail(msg.user_email)))
{
msg_err += msg_error_email + '\n';
}
}
else
{
msg_err += msg_empty_email + '\n';
}
if (msg.msg_title.length == 0)
{
msg_err += msg_title_empty + '\n';
}
if (frm.elements['captcha'] && msg.captcha.length==0)
{
msg_err += msg_captcha_empty + '\n'
}
if (msg.msg_content.length == 0)
{
msg_err += msg_content_empty + '\n'
}
if (msg.msg_qq.length == 0)
{
msg_err += 'QQ不能为空\n';
}
if (msg.msg_title.length > 200)
{
msg_err += msg_title_limit + '\n';
}
if (msg_err.length > 0)
{
alert(msg_err);
return false;
}
else
{
return true;
}
}
{/literal}
</script>
步骤 2. 更改文件message.php
$message = array(
'user_id' => $user_id,
'user_name' => $user_name,
'user_email' => isset($_POST['user_email']) ? htmlspecialchars(trim($_POST['user_email'])) : '',
'msg_qq' => isset($_POST['msg_qq']) ? trim($_POST['msg_qq']) : '',
'msg_type' => isset($_POST['msg_type']) ? intval($_POST['msg_type']) : 0,
'msg_title' => isset($_POST['msg_title']) ? trim($_POST['msg_title']) : '',
'msg_content' => isset($_POST['msg_content']) ? trim($_POST['msg_content']) : '',
'order_id' => 0,
'msg_area' => 1,
'upload' => array()
);
步骤 2. 更改文件lib_clips.php
$message['msg_area'] = isset($message['msg_area']) ? intval($message['msg_area']) : 0;
$sql = "INSERT INTO " . $GLOBALS['ecs']->table('feedback') .
" (msg_id, parent_id, user_id, user_name, user_email,msg_qq, msg_title, msg_type, msg_status, msg_content, msg_time, message_img, order_id, msg_area)".
" VALUES (NULL, 0, '$message[user_id]', '$message[user_name]', '$message[user_email]', ".
" '$message[msg_qq]','$message[msg_title]', '$message[msg_type]', '$status', '$message[msg_content]', '".gmtime()."', '$img_name', '$message[order_id]', '$message[msg_area]')";
$GLOBALS['db']->query($sql);