<script charset="utf-8" src="<?php bloginfo('template_url'); ?>/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="<?php bloginfo('template_url'); ?>/kindeditor/lang/zh_CN.js"></script>
<script>
KindEditor.ready(function(K) {
K.each({
'plug-align' : {
name : '对齐方式',
method : {
'justifyleft' : '左对齐',
'justifycenter' : '居中对齐',
'justifyright' : '右对齐'
}
},
'plug-order' : {
name : '编号',
method : {
'insertorderedlist' : '数字编号',
'insertunorderedlist' : '项目编号'
}
},
'plug-indent' : {
name : '缩进',
method : {
'indent' : '向右缩进',
'outdent' : '向左缩进'
}
}
},function( pluginName, pluginData ){
var lang = {};
lang[pluginName] = pluginData.name;
KindEditor.lang( lang );
KindEditor.plugin( pluginName, function(K) {
var self = this;
self.clickToolbar( pluginName, function() {
var menu = self.createMenu({
name : pluginName,
width : pluginData.width || 100
});
K.each( pluginData.method, function( i, v ){
menu.addItem({
title : v,
checked : false,
iconClass : pluginName+'-'+i,
click : function() {
self.exec(i).hideMenu();
}
});
})
});
});
});
var editor=K.create('#contentqq', {
themeType : 'qq',
items : [
'bold','italic','underline','fontname','fontsize','forecolor','hilitecolor','plug-align','plug-order','plug-indent','link'
]
});
//按钮提交事件
K('input[name=sub]').click(function(e) {
//ajax提交到服务器
$.get("http://www.itbuluoge.com/?my_custom_page=content-comment",
{
currentid:<?php echo get_the_ID(); ?>,
mes:editor.html(),
},
function(data,status){
//成功提交
var i=0;
add(i,editor.html());
i++;
editor.html("");
if(data=="ok")
{
$("#state").html("评论成功,获得金币");
}
else
{
//没有登录
$("#state").html("评论成功,但是未登录,无法获得金币");
}
});
});
});
</script>
<script>
function CurrentTime()
{
var now = new Date();
var year = now.getFullYear(); //年
var month = now.getMonth() + 1; //月
var day = now.getDate(); //日
var hh = now.getHours(); //时
var mm = now.getMinutes(); //分
var clock = year + "-";
if(month < 10) clock += "0";
clock += month + "-";
if(day < 10) clock += "0";
clock += day + " ";
if(hh < 10) clock += "0";
clock += hh + ":";
if (mm < 10) clock += '0';
clock += mm;
return(clock);
}
</script>
<script type="text/javascript">
function addDiv(){
var nowDate=CurrentTime();
var obj=document.getElementById("myDiv");
var newNode= document.createElement("div");
newNode.setAttribute("id","a1");
newNode.style.border="1px solid #000";
newNode.innerHTML=document.getElementById("username_id").value+" "+nowDate+"<br>"
+document.getElementById("content_id").value;
obj.appendChild(newNode);
document.getElementById("username_id").value="";
document.getElementById("content_id").value="";
}
</script>
<div class="main">
<?php $currenid=get_the_ID(); ?>
<!--视频部分开始!-->
<div class="edit-program">
<div class="edit-file-name div-radius-6">
<span><?php $categories = get_the_category(); ?><?php echo "<a href=?my_custom_page=page-list&cat_name=".$categories[0]->slug.">".$categories[0]->cat_name."</a>";?></span>
</div>
<div class="edit-language video-title">
<span><?php the_title(); ?></span>
</div>
<div class="clear"></div>
<div class="text-frame">
<?php the_content(); ?>
<?php $keywords = "";
$tags = wp_get_post_tags($post->ID);
foreach ($tags as $tag ) {
$keywords = $keywords.$tag->name. " ";
};
if($keywords!="")
{
echo "关键词:".$keywords;
}
?>
<p align=right>文章来自<a href="http://www.itbuluoge.com">IT部落格</a>,http://www.itbuluoge.com,版权所有,转载请注明出处!</p>
<p></p>
</div>
<div class="text-share" align=right>
<div class="bshare-custom icon-medium-plus"><a title="分享到QQ空间" class="bshare-qzone"></a><a title="分享到新浪微博" class="bshare-sinaminiblog"></a><a title="分享到人人网" class="bshare-renren"></a><a title="分享到腾讯微博" class="bshare-qqmb"></a><a title="分享到网易微博" class="bshare-neteasemb"></a><a title="更多平台" class="bshare-more bshare-more-icon more-style-addthis"></a><span class="BSHARE_COUNT bshare-share-count">0</span></div><script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/buttonLite.js#style=-1&uuid=&pophcol=2&lang=zh"></script><script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/bshareC0.js"></script>
</div>
</div>
<!--视频部分结束!-->
<!--相关视频列表开始!-->
<div class="edit-error video-relate-list">
<div class="edit-error-name">
<p>相关列表</p>
</div>
<ul>
<?php
//取相关的5篇文章
$slug=$categories[0]->slug;
$result = $wpdb->get_results("SELECT wp_posts.`ID`,wp_posts.`post_title` FROM wp_posts,wp_terms,wp_term_relationships WHERE wp_terms.`term_id`=wp_term_relationships.`term_taxonomy_id`
AND wp_posts.`ID`=wp_term_relationships.`object_id` AND wp_terms.`slug`='$slug' AND wp_posts.`post_status`='publish' ORDER BY wp_posts.`post_date` LIMIT 5");
foreach ($result as $post) {
setup_postdata($post);
$postid = $post->ID;
$title = $post->post_title;
?>
<li>
<a href="<?php echo get_permalink($postid); ?>" title="<?php echo $title ?>"><?php echo mb_strimwidth($title, 0, 30,"···"); ?>
</a>
</li>
<?php } ?>
</ul>
<div class="edit-error-name">
<p>最新文章</p>
</div>
<ul>
<?php
//取最新10篇文章
$result = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts where post_status='publish' ORDER BY post_date DESC LIMIT 5");
foreach ($result as $post) {
setup_postdata($post);
$postid = $post->ID;
$title = $post->post_title;
?>
<li>
<a href="<?php echo get_permalink($postid); ?>" title="<?php echo $title ?>"><?php echo mb_strimwidth($title, 0, 30,"···"); ?></a>
</li>
<?php } ?>
</ul>
</div>
<!--评论开始!-->
<div class="text-answer">
<ul id="myUl">
<?php
//获取当前文章的10篇评论
$results = $wpdb->get_results("SELECT * FROM wp_comments,wp_users WHERE wp_comments.`user_id`=wp_users.`ID` AND wp_comments.`comment_post_ID`=".$currenid." order by wp_comments.comment_date desc limit 10");
foreach ($results as $result) {
?>
<li>
<div class="text-answer-li-title">
<p>评论就可以获得金币哦!</p>
</div>
<div class="text-answer-li-con">
<p>
<?php echo $result->comment_content;?>
</p>
</div>
<div class="text-answer-li-user">
<p><?php echo $result->user_nicename;?></p>
<p>
<span><?php echo $result->comment_date;?></span>
</p>
</div>
</li>
<?php
} ?>
</ul>
</div>
<!--评论结束!-->
<!--回复框!-->
<div class="comment">
<textarea id="contentqq" rows="5" cols="102" name="myanswer">
</textarea>
<div id="state">不登陆也可以评论,但是登录后评论就能获得金币哦!</div>
<input type="submit" value="回复" class="div-btn comment-part-edit-btn" name="sub" id="sub"/>
</div>
<script type="text/javascript">
function add(i,data){
var obj=document.getElementById("myUl");
var newli= document.createElement("li");
newli.id="li"+i;
obj.appendChild(newli);
var newdiv1=document.createElement("div");
newdiv1.className="question-answer-li-title";
newdiv1.innerHTML="<p>我的评论</p>";
newli.appendChild(newdiv1);
var newdiv2=document.createElement("div");
newdiv2.className="question-answer-li-con";
newdiv2.innerHTML="<p>"+data+"</p>";
newli.appendChild(newdiv2);
var newdiv3=document.createElement("div");
newdiv3.className="question-answer-li-user";
newdiv3.innerHTML="<p>我</p><p><span>刚刚</span></p>";
newli.appendChild(newdiv3);
}
</script>
<script type="text/javascript">
$(document).ready(function(){
var i=0;
$("#sub").click(function(){
alert(K.html("contentqq"));
/*
add(i);
i++;*/
})
});
</script>
<!--回复结束!-->
IT部落格(http://www.itbuluoge.com)-快乐快速学习,专注于免费编程教程,在线编程,IT面试笔记,IT面试经验