@
shiji 那个系统储存评论代码是在一个 php 里
<?php
$mc_config = array (
'user_nick' => '***',
'comment_code' => '<!-- 多说评论框 start -->
<div class="ds-thread" data-thread-key="<?php mc_the_name(); ?>" data-title="<?php mc_the_name(); ?>" data-url="<?php curPageURL(); ?>"></div>
<!-- 多说评论框 end -->
<!-- 多说公共 JS 代码 start (一个网页只需插入一次) -->
<script type="text/javascript">
var duoshuoQuery = {short_name:"***"};
(function() {
var ds = document.createElement('script');
ds.type = 'text/javascript';ds.async = true;
ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//
static.duoshuo.com/embed.js'; ds.charset = 'UTF-8';
(document.getElementsByTagName('head')[0]
|| document.getElementsByTagName('body')[0]).appendChild(ds);
})();
</script>
<!-- 多说公共 JS 代码 end -->',
'url_rewrite' => 'off',
'post_nums' => '10',
)
?>
然后主页的 php 是这样的
<?php
function curPageURL()
{
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on")
{
$pageURL .= "s";
}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80")
{
$pageURL .= $_SERVER["SERVER_NAME"].":" . $_SERVER["SERVER_PORT"] . $_SERVER['PHP_SELF'];
}
else
{
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER['PHP_SELF'];
}
return $pageURL;
}
?>
<!DOCTYPE html>
<html dir="ltr" lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name=viewport content="width=device-width, initial-scale=1, maximum-scale=1">
<title><?php if (mc_is_post() || mc_is_page()) { mc_the_title(); ?> | <?php mc_site_name(); } else { mc_site_name(); ?> | <?php mc_site_desc(); }?></title>
<link href="<?php mc_theme_url('style.css'); ?>" type="text/css" rel="stylesheet"/>
<link rel="shortcut icon" href="/favicon.ico"/>
<link rel="bookmark" href="/favicon.ico" type="image/x-icon"/>
</head>
<body>
<div id="main">
<div id="header">
<div id="sitename"><a href="<?php mc_site_link(); ?>"><?php mc_site_name(); ?></a></div>
</div>
<div id="content">
<div id="content_box">
<?php if (mc_is_post()) { ?>
<div class="post">
<h1 class="title"><?php mc_the_link(); ?></h1>
<div class="tags"><?php mc_the_tags('','',''); ?> by <?php mc_nick_name(); ?> at <?php mc_the_date(); ?></div>
<div class="content"><?php mc_the_content(); ?></div>
</div>
<?php if (mc_can_comment()) { ?>
<?php mc_comment_code(); ?> //评论似乎在这里
<?php } ?>
<?php } else if (mc_is_page()) { ?>
<div class="post">
<?php /*<h1 class="title"><?php mc_the_link(); ?></h1>
<div class="tags">by <?php mc_nick_name(); ?> at <?php mc_the_date(); ?></div> */ ?>
<div class="content"><?php mc_the_content(); ?></div>
</div>
<?php if (mc_can_comment()) { ?>
<?php mc_comment_code(); ?> //评论似乎在这里
<?php } ?>
<?php } else if (mc_is_archive()) { ?>
<div class="date_list">
<h1>月份</h1>
<ul>
<?php mc_date_list(); ?>
</ul>
</div>
<div class="tag_list">
<h1>标签</h1>
<ul>
<?php mc_tag_list(); ?>
</ul>
</div>
<div class="clearer"></div>
<?php } else { ?>
<?php if (mc_is_tag()) { ?>
<div id="page_info"><span><?php mc_tag_name(); ?></span></div>
<?php } else if (mc_is_date()) { ?>
<div id="page_info"><span><?php mc_date_name(); ?></span></div>
<?php } ?>
<div class="post_list">
<?php while (mc_next_post()) { ?>
<div class="post">
<h1 class="title"><?php mc_the_link(); ?></h1>
<div class="tags"><?php mc_the_tags('','',''); ?> by <?php mc_nick_name(); ?> at <?php mc_the_date(); ?></div>
<div class="clearer"></div>
</div>
<?php } ?>
<div id="page_bar">
<?php if (mc_has_new()) { ?>
<span class="prev" style="float:left;"><?php mc_goto_new('←较新文章'); ?></span>
<?php } ?>
<?php if (mc_has_old()) { ?>
<span class="next" style="float:right;"><?php mc_goto_old('早期文章→'); ?></span>
<?php } ?>
<div class="clearer"></div>
</div>
<div class="clearer"></div>
</div>
<?php } ?>
</div>
</div>
<div id="side">
<div id="navbar">
<ul>
<li><a href="<?php mc_site_link(); ?>/">首页</a></li>
<?php
if($mc_config['url_rewrite'] == 'on'){
$archive_url = '/archive/';
$rss_url = '/rss/';
}else{
$archive_url = '/?archive/';
$rss_url = '/?rss/';
}
?>
<li><a href="***">关于</a></li>
<li><a href="<?php mc_site_link(); echo $archive_url; ?>">存档</a></li>
<li><a href="<?php mc_site_link(); echo $rss_url; ?>">订阅</a></li>
</ul>
</div>
</div>
<div class="clearer"></div>
</div>
</body>
</html>