织梦dedecms仿制留言板功能

最近,在使用DEDECMS做网站的时候,遇到一个留言板要仿制,研究了下,发现织梦自带留言板,做完就顺便记录下。留言板最近用的不多,如果遇到,可以按照模板中的步骤制作即可。
一、安装留言板
后台——>模板——>模板管理——>找到留言板模块安装即可。
二、查看留言板
留言板安装成功后,在核心——>网站栏目管理中,可以看到已安装的留言板栏目。
三、预览织梦自带的留言板
预览留言板的目的,是进入浏览界面,发布几条留言信息,通过留言案例,使用相关标签,仿制留言板。
四、模板替换与仿制
找到/templets/plus/guestbook.htm,复制一份用途备份,然后把自自己要仿制的目标页面代码放到guestbook.htm中,按照下面代码中的10步,替换相应标签即可完成留言板仿制。
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--第一步:标题调用标签-->
<title><?php echo $cfg_webname; ?> - 留言本</title>
<link rel="stylesheet" href="<?php echo $cfg_templeturl; ?>/pcwap/style/83602b8717182ea7c55d1dc3d1f40b5b.css" data-minify="1" />
<!--第二步:CSS调用标签-->
<link rel='stylesheet' href='<?php echo $cfg_templeturl; ?>/pcwap/style/iconfont.css' type='text/css' />
<style type="text/css">
img.wp-smiley,img.emoji{display:inline!important;border:none!important;box-shadow:none!important;height:1em!important;width:1em!important;margin:0 .07em!important;vertical-align:-0.1em!important;background:none!important;padding:0!important}
</style>
<link rel='stylesheet' id='woocommerce-smallscreen-css'  href='<?php echo $cfg_templeturl; ?>/pcwap/style/woocommerce-smallscreen-3.4.5.css' type='text/css' media='only screen and (max-width: 768px)' />
<style id='woocommerce-inline-inline-css' type='text/css'>
.woocommerce form .form-row .required{visibility:visible}
</style>
<style id='onepress-style-inline-css' type='text/css'>
#main .video-section section.hero-slideshow-wrapper{background:transparent}.hero-slideshow-wrapper:after{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.3);display:block;content:""}.body-desktop .parallax-hero .hero-slideshow-wrapper:after{display:none!important}#parallax-hero>.parallax-bg::before{background-color:rgba(0,0,0,.3);opacity:1}.body-desktop .parallax-hero .hero-slideshow-wrapper:after{display:none!important}.gallery-carousel .g-item{padding:0 1px}.gallery-carousel{margin-left:-1px;margin-right:-1px}.gallery-grid .g-item,.gallery-masonry .g-item .inner{padding:1px}.gallery-grid,.gallery-masonry{margin:-1px}
</style>
<noscript>
<style>
.woocommerce-product-gallery{opacity:1!important}
</style>
</noscript>
<style type="text/css">
.recentcomments a{display:inline!important;padding:0!important;margin:0!important}
</style>
</head>
<body class="post-template-default single single-post postid-37 single-format-standard wp-custom-logo woocommerce-no-js elementor-default">
<!--第五步:头部调用标签-->
<?php
  pasterTempletDiy("pcwap/head.htm");
?>
  </div>
  <div id="content" class="site-content">
    <div class="breadcrumbs" typeof="BreadcrumbList" >
      <div class="container"> <a href='<?php echo $cfg_basehost;?>/'>主页</a> > <a>留言板</a></div>
    </div>
    <div id="content-inside" class="container right-sidebar">
      <div id="primary" class="content-area">
        <main id="main" class="site-main" role="main">
          <article id="post-37" class="post-37 post type-post status-publish format-standard has-post-thumbnail hentry category-apps category-one-page category-responsive tag-export">
            <header class="entry-header">
              <h1 class="entry-title">{dede:field.title/}</h1>
             <div class="entry-meta"> 
<span class="posted-on">发布时间: 
    <a href="{dede:global.cfg_basehost/}" rel="bookmark">
                <time class="entry-date published" datetime="{dede:field.pubdate function="MyDate('Y-m-d',@me)"/}">{dede:field.pubdate function="MyDate('Y-m-d',@me)"/}</time>
                <time class="updated hide" datetime="{dede:field.pubdate function="MyDate('Y-m-d',@me)"/}">{dede:field.pubdate function="MyDate('Y-m-d',@me)"/}</time>
                </a>
</span>
<span class="byline"> 作者: 
  <span class="author vcard"><a  rel="author" class="url fn n" href="{dede:global.cfg_basehost/}">{dede:field.writer/}</a> </span>
</span>
<span class="byline"> 来源: 
  <span class="author vcard"><a  rel="author" class="url fn n" href="{dede:global.cfg_basehost/}">{dede:field.source/}</a> </span>
</span>
<span class="byline"> 浏览量: 
  <span class="author vcard"><a  rel="author" class="url fn n" href="{dede:global.cfg_basehost/}"><script src="{dede:field name='phpurl'/}/count.php?view=yes&aid={dede:field name='id'/}&mid={dede:field name='mid'/}"type='text/javascript' language="javascript"></script></a> </span>
</span>
</div>
            </header>
            <div class="entry-content">
             {dede:field.body/}
            </div>
            <footer class="entry-footer"><span class="cat-links">
相关标签: 
{dede:tag row='8' getall='0'}
<a href="[field:link/]" rel="category tag">[field:tag /]</a> 
{/dede:tag} 
</footer>
          </article>
          <div id="comments" class="comments-area">
            <h3 class="comments-title"> 热门<span>评论</span></h3>
            <ol class="comment-list">
<!--第八步:留言数据循环标签-->
{dede:datalist}
              <li class="comment even thread-even depth-1" id="li-comment-3">
                <article id="comment-3" class="comment clearfix">
<img alt='' src='<?php echo $cfg_templeturl; ?>/pcwap/images/358a8743850e818ddabfec82b39ed62c.jpeg' srcset='<?php echo $cfg_templeturl; ?>/pcwap/images/358a8743850e818ddabfec82b39ed62c.jpeg 2x' class='avatar avatar-60 photo' height='60' width='60' />
                  <div class="comment-wrapper">
                    <header class="comment-meta comment-author vcard"> 
<cite>
<b class="fn">
<a href='/' rel='external nofollow' class='url'><?php echo $fields['uname']; ?></a>
</b> 
</cite>
<a class="comment-time" href="/">
                      <time datetime="<?php echo MyDate('Y-m-d H:i',$fields['dtime']); ?>"><?php echo MyDate('Y-m-d H:i',$fields['dtime']); ?></time>
                    </a>
</header>
                    <div class="comment-content entry-content">
                      <p><?php echo $fields['msg']; ?></p>
                    </div>
<?php if($g_isadmin) { ?>                                                                       
<a href='guestbook.php?action=admin&id=<?php echo $fields['id']; ?>&job=del'>[删除]</a>
<a href='guestbook.php?action=admin&id=<?php echo $fields['id']; ?>'>[回复/编辑]</a><br />
<a>邮箱:<?php echo $fields["email"]?></a><br />
<a>主页:<?php echo $fields['homepage']?></a><br />
<a>IP地址:<?php echo preg_replace("#[^.]*.[^.]*$#","*.*",$fields['ip']); ?></a><br />
<?php echo $i;?>
<?php }  ?>
                  </div>
                </article>
              </li>
{/dede:datalist}  
<!--第九步:分页标签-->
  {dede:pagelist listsize='5'/}
            </ol>
            <div id="respond" class="comment-respond">
              <h3 id="reply-title" class="comment-reply-title">发表评论 <small><a rel="nofollow" id="cancel-comment-reply-link" href="" style="display:none;">Cancel reply</a></small></h3>
<!-- 第十步:留言框相关标签-->
              <form action="guestbook.php" method="post" id="commentform" class="comment-form" novalidate>
   <input type='hidden' name='action' value='save' />
                <p class="comment-notes"><span id="email-notes">Your email address will not be published.</span> Required fields are marked <span class="required">*</span></p>
                <p class="comment-form-comment">
                  <label for="comment">内容</label>
                  <textarea id="comment" name="msg" cols="45" rows="8" maxlength="65525" required="required"></textarea>
                </p>
                <p class="comment-form-author">
                  <label for="author">昵称 <span class="required">*</span></label>
                  <input id="author" name="uname" type="text" value="" size="30" maxlength="245" required='required' />
                </p>
                <p class="comment-form-email">
                  <label for="email">邮箱(仅管理员可见) <span class="required">*</span></label>
                  <input id="email" name="email" type="email" value="" size="30" maxlength="100" aria-describedby="email-notes" required='required' />
                </p>
                <p class="comment-form-url">
                  <label for="url">手机(仅管理员可见)</label>
                  <input id="url" name="homepage" type="url" value="" size="30" maxlength="200" />
                </p>
<p class="comment-form-url">
                  <label for="url">验证码</label>
                  <input name="validate" type="text" id="vdcode2" class="ipt-txt" style="width:60px;text-transform: uppercase;" />&nbsp;&nbsp;&nbsp;&nbsp;
  <img src='../include/vdimgck.php'/>
                </p>
                <p class="form-submit">
                  <input name="submit" type="submit" id="submit" class="submit" value="提交留言" />
                  <input type='hidden' name='comment_post_ID' value='37' id='comment_post_ID' />
                  <input type='hidden' name='comment_parent' id='comment_parent' value='0' />
                </p>
                <p style="display: none;">
                  <input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="2de56b5a87" />
                </p>
                <p style="display: none;">
                  <input type="hidden" id="ak_js" name="ak_js" value="248"/>
                </p>
              </form>
            </div>
          </div>
        </main>
      </div>  
<!--第六步:右侧调用标签-->
<?php
  pasterTempletDiy("pcwap/right.htm");
?> 
    </div>
  </div>
<!--第七步:底部调用标签-->
<?php
  pasterTempletDiy("pcwap/footer.htm");
?>
</div>
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','<?php echo $cfg_templeturl; ?>/pcwap/style/analytics.js','ga');
  ga('create', 'UA-51319459-2', 'auto');
  ga('send', 'pageview');</script>
<!--第四步:JS调用标签-->
<script src="<?php echo $cfg_templeturl; ?>/pcwap/style/4fa797f036555a3fe017b1231d3ce95b.js" data-minify="1"></script>
</body>
</html>