首页 > 代码库 > 商城用户评论优化

商城用户评论优化

优化后结果展示:

具体操作如下:

一、修改/admin/comment_manage.php 

$smarty->assign(‘admin_info‘,   $admin_info); //管理员信息  

替换为:

$smarty->assign(‘user_name‘,   $comment_info[‘user_name‘]); //评论者用户名$smarty->assign(‘user_email‘,   $comment_info[‘email‘]); //评论者邮箱

删除一下语句:

$sql = "SELECT user_name, email FROM ". $ecs->table(‘admin_user‘).           " WHERE user_id = ‘$_SESSION[admin_id]‘";    $admin_info = $db->getRow($sql);

二、修改/admin/templates/comment_info.htm

<tr>	<td>{$lang.user_name}:</td>	<td><input name="user_name" type="text" {if $reply_info.user_name eq ""}value="http://www.mamicode.com/{$admin_info.user_name}"{else} value="http://www.mamicode.com/{$reply_info.user_name}"{/if} size="30" readonly="true" /></td></tr><tr>	<td>{$lang.email}:</td>	<td><input name="email" type="text" {if $reply_info.email eq ""}value="http://www.mamicode.com/{$admin_info.email}"{else} value="http://www.mamicode.com/{$reply_info.email}"{/if} size="30" readonly="true" /></td></tr>

替换为:

<tr>	<td>{$lang.user_name}:</td>	<td><input name="user_name" type="text" {if $user_name}value="http://www.mamicode.com/{$user_name}"{else} value="http://www.mamicode.com/{$lang.anonymous}"{/if} size="30" readonly="true" /></td></tr><tr>	<td>{$lang.email}:</td>	<td><input name="email" type="text" value="http://www.mamicode.com/{$user_email}" size="30" readonly="true" /></td></tr>

注:本人为业余爱好者,如果有说的不对,勿喷。交流学习才是王道!

修改文件library\comments_list.lbi修改文本输入框禁止编辑等。查找name="email" id="email",在<input>标签添加 readonly="readonly" 为只读属性,即可.

 

商城用户评论优化