只有会员才可以发表评论。 实现原理:判断是否登录,是,则加载评论框和按钮等,否,则提示只有注册或登录后才可以发表评论。
下面列出需要修改的文件的代码:
1、文章页模板article_article.htm (以下代码插入你模板的合适位置):
Copy to ClipboardLiehuo.Net Codes引用的内容:[]
<div class="box">
<h2><a name="comment">评论内容</a></h2>
<p> </p>
<div class="content">
<form action=http://www.dede58.com/"{dede:field name='phpurl'/}/feedback.php" method="post" name="feedback">
<input type="hidden" name="action" value="send" />
<input type="hidden" name="comtype" value="comments">
<input type="hidden" name="aid" value=http://www.dede58.com/"{dede:field name="id"/}" />
<input type="hidden" name="isconfirm" value="yes" />
<p>
<script language='javascript' type='text/javascript' src=http://www.dede58.com/"{dede:field name='phpurl'/}/feedback_js.php?aid={dede:field name='id'/}"></script>
<br></p>
<p><label for="txaArticle"></label></p>
<div class="dcmp-userinfo" id="_ajax_feedback">
请您<b><a target="_blank" href=http://www.dede58.com/"{dede:global.cfg_memberurl/}/index_do.php?fmdo=user&dopost=regnew"><font size="4" color="#008000">注册</font></a></b>或者<b><a target="_blank" href=http://www.dede58.com/"{dede:global.cfg_memberurl/}/login.php"><font size="4" color="#008000">登录</font></a></b>后发表评论! 忘记密码了?点击<b><a target="_blank" href=http://www.dede58.com/"{dede:global.cfg_memberurl/}/resetpassword.php"><font color="#008000" size="4">这里</font></a></b>找回密码!
</div>
<script language="javascript" type="text/javascript">CheckLogin();</script>
</p><br>
</form>
</div></div>
2、member目录下的ajax_feedback.php (全部内容):
Copy to ClipboardLiehuo.Net Codes引用的内容:[]
<?php
require_once(dirname(__FILE__)."/config.php");
AjaxHead();
if($myurl == '')
{
exit('');
}
$uid = $cfg_ml->M_LoginID;
$face = $cfg_ml->fields['face'] == '' ? $GLOBALS['cfg_memberurl'].'/images/nopic.gif' : $cfg_ml->fields['face'];
?>
<p>
<div class="dcmp-mood">
<strong>评价:</strong>
<ul>
<li><input type="radio" name="feedbacktype" checked="1" value="feedback" id="dcmp-stand-neu" /><label for="dcmp-stand-neu"><img src=http://www.dede58.com/"/templets/images/cmt-neu.gif" />中立</label>
<li><input type="radio" name="feedbacktype" value="good" id="dcmp-stand-good" /><label for="dcmp-stand-good"><img src=http://www.dede58.com/"/templets/images/cmt-good.gif" />好评</label>
<li><input type="radio" name="feedbacktype" value="bad" id="dcmp-stand-bad" /><label for="dcmp-stand-bad"><img src=http://www.dede58.com/"/templets/images/cmt-bad.gif" />差评</label>
</ul>
</div>
</p>
<div class="dcmp-mood">
<strong>表情:</strong>
<ul>
<li><input type="radio" name='face' value='6' checked="1" /><img src=http://www.dede58.com/"/templets/images/mood/ico-mood-6.gif" /></li>
<li><input type="radio" name='face' value='4'/><img src=http://www.dede58.com/"/templets/images/mood/ico-mood-4.gif" /></li>
<li><input type="radio" name='face' value='3'/><img src=http://www.dede58.com/"/templets/images/mood/ico-mood-3.gif" /></li>
<li><input type="radio" name='face' value='5'/><img src=http://www.dede58.com/"/templets/images/mood/ico-mood-5.gif" /></li>
<li><input type="radio" name='face' value='2'/><img src=http://www.dede58.com/"/templets/images/mood/ico-mood-2.gif" /></li>
<li><input type="radio" name='face' value='1'/><img src=http://www.dede58.com/"/templets/images/mood/ico-mood-1.gif" /></li>
<li><input type="radio" name='face' value='7'/><img src=http://www.dede58.com/"/templets/images/mood/ico-mood-7.gif" /></li>
</ul>
</div>
<p><textarea cols="60" name="msg" rows="5" class="ipt-txt" style="width:600px; height:100px;" ></textarea></p>
以用户名 <?php echo $cfg_ml->M_UserName; ?> 发表评论,请控制在200字以内。系统会自动记录你的IP地址,请勿发布非法信息!