[前台调用]评论调用DYCMS
<!--评论开始-->
<div class="comment_03"><h1>我要评论</h1></div>
<form name="commentfrm" id="commentfrm" method="post">
<div class="comment_08"><textarea name="content" id="content" placeholder="评论内容"></textarea></div>
<div class="comment_01">
<dl>
<dt style="width: 48px;">昵称:</dt>
<dd><input type="text" name="xingming" id="xingming" /></dd>
</dl>
<?php if($config['commentcheckcode']==0){?>
<dl>
<dt style="width: 65px;">验证码:</dt>
<dd style="width: 200px;">
<input type="text" name="checkcode" id="checkcode" />
<img src='../inc/checkcode.php' align="absmiddle" onClick="this.src='../inc/checkcode.php?'+Math.random();">
</dd>
</dl>
<?php }?>
</div>
<div class="comment_02">
<input type="button" id="subcomment" value="发表评论" onclick="javascript:if(checkcommentfrm()){document.commentfrm.action='?id=<?php echo $id?>&action=add';document.commentfrm.submit();}" />
</div>
</form>
<div style="clear: both;"></div>
<div id="comment" class="comment_03 comment_07"><h1>最新评论</h1></div>
<div class="comment_04">
<ul>
<?php
if($listresult->num_rows>0){
while($list = $listresult->fetch_assoc()) {
?>
<li>
<div class="comment_05">
<span><i class="remixicon-time-line"></i> <?php echo date('Y-m-d',$list["addtime"])?></span>
<i class="remixicon-user-line"></i> <strong><?php echo $list["xingming"]?></strong>
</div>
<p><?php echo $list["content"]?></p>
<?php if($list["reply"]!=''){?>
<div class="comment_06">
<strong>管理员回复:</strong><?php echo $list["reply"]?>
</div>
<?php }?>
</li>
<?php
}
}
?>
</ul>
</div>
<!--分页开始-->
<div class="list-page">
<a href='javascript:void(0);'>共<?php echo $all_num?>条</a>
<a href='javascript:void(0);'>共<?php echo $page_all_num?>页</a>
<a href='javascript:void(0);'><?php echo $page_num?>条/页</a>
<a href='?id=<?php echo $id?>#comment'>首页 </a>
<a href='?id=<?php echo $id?>&page=<?php echo $ps?>#comment'>上一页 </a>
<a href='?id=<?php echo $id?>&page=<?php echo $px?>#comment'>下一页 </a>
<a href='?id=<?php echo $id?>&page=<?php echo $page_all_num?>#comment'>尾页 </a>
<select name="ToPage" id="ToPage" onChange="GoToPage();">
<?php
for($topagei=1;$topagei<=$page_all_num;$topagei++){
?>
<option value="<?php echo $topagei?>"<?php if($page==$topagei){?> selected="selected"<?php }?>>第<?php echo $topagei?>页</option>
<?php }?>
</select>
<script language="javascript">
//跳转页
function GoToPage(){
var getpage
getpage=document.getElementById("ToPage").value
location='?id=<?php echo $id?>&page='+getpage+'#comment'
}
</script>
</div>
<!--分页结束-->
<script type="text/javascript">
function checkcommentfrm() {
if(document.commentfrm.content.value == "") {
alert('请输入评论内容!');
document.commentfrm.content.focus();
return false;
}
if(document.commentfrm.xingming.value == "") {
alert('请输入昵称!');
document.commentfrm.xingming.focus();
return false;
}
<?php if($config['commentcheckcode']==0){?>
if(document.commentfrm.checkcode.value == "") {
alert('请输入验证码!');
document.commentfrm.checkcode.focus();
return false;
}
<?php }?>
return true;
}
</script>
<!--评论结束-->
css样式:
/*评论样式定义开始*/
.comment_01{padding-top: 20px;}
.comment_01 dl{float: left;}
.comment_01 dl dt{float: left;font-size: 16px;color: #5A5D5A;line-height: 30px;}
.comment_01 dl dd{width:130px;float: left;}
.comment_01 dl dd input{border: 1px solid #DDD;width: 100px;height: 30px;padding-left: 10px;font-family: "微软雅黑";font-size: 16px;color: #5A5D5A;vertical-align:middle;}
.comment_01 dl dd input:focus{outline: none;}
.comment_01 dl dd img{vertical-align:middle;}
.comment_02{float: right;}
.comment_02 input{border: none;background: #f60;color: #fff;padding: 5px 30px;font-size: 18px;font-family: "微软雅黑";cursor: pointer;}
.comment_02 input:hover{background: #DE5D05;}
.comment_02 input:focus{outline: none;}
.comment_03{border-bottom: 1px solid #D9D9D9;height:40px;line-height: 40px;font-size: 16px;color: #FFF;}
.comment_03 h1{width:120px;background:#257FEB;text-align:center;font-size: 18px;font-weight:100;color: #fff;}
.comment_04 li{border-bottom: 1px solid #eee;padding: 10px 5px;font-family: "微软雅黑";font-size: 14px;color: #5A5D5A;}
.comment_04 p{line-height: 24px;}
.comment_05{height: 30px;}
.comment_05 span{float: right;}
.comment_05 strong{color: #3366FF;}
.comment_06{line-height: 24px;margin-top: 8px;}
.comment_06 strong{color: #f60;}
.comment_07{margin-top: 40px;}
.comment_08{margin-top: 20px;}
.comment_08 textarea{border: 1px solid #DDD;width:739px;height: 100px;padding: 10px;font-family: "微软雅黑";font-size: 16px;color: #5A5D5A;}
.comment_08 textarea:focus{outline: none;}
/*评论样式定义结束*/
上一篇:[前台调用]在线留言调用
下一篇:[插件]仿QQ商城幻灯代码
我要评论