自己制作的模版,无法提交评论

1、自己制作的typecho模版在"post"页面、“关于”页面、都无法提交评论.

2、我担心是自己的comments.php模版制作有问题,把自己制作的comments.php更换成默认模版自带的comments.php,问题依然存在。

3、我担心是自己的post.php模版制作有问题,把自己制作的post.php更换成默认模版自带的post.php,问题依然存在。

4、我同时把自己的制作的post和comments替换成默认的,问题依然存在。

5、https://segmentfault.com/q/10... 这个方案,无法解决我的问题。

6、typecho的前辈高手们,万望能给予纸指点,实在是找不到由头了。

7、下面的代码是:header.php

<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Cache-Control" content="no-transform" />
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title><?php $this->archiveTitle(array(
        'category'  =>  _t('分类 %s 下的文章'),
        'search'    =>  _t('包含关键字 %s 的文章'),
        'tag'       =>  _t('标签 %s 下的文章'),
        'author'    =>  _t('%s 发布的文章')
        ), '', ' - '); ?><?php $this->options->title(); ?></title>
    <meta name="description" content="<?php $this->options->description(); ?>">
    <meta name="keywords" content="<?php $this->options->keywords(); ?>">
    <link rel="stylesheet" href="<?php $this->options->themeUrl('info.css'); ?>" type="text/css">
</head>

<body>
<div id="infoAll">
    <div id="infoHead">
        <div class="infoNull1"></div>
        <div id="infoTitle"><a href="######">&nbsp;&nbsp;#####</a></div>
        <div class="infoNull2"></div>
        <div id="infoSubTitle">&nbsp;&nbsp;&nbsp;######</div>
    </div>
    <div class="infoNull3"></div>

8、下面的代码是post.php

<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('header.php'); ?>

    <div id="infoBody">
        <div id="infoLeft">
            <div id="infoContent">
                <h2><?php $this->title() ?></h2>
                分类:<?php $this->category(','); ?>&nbsp;|&nbsp; 
                标签:<?php $this->tags(', ', true, 'none'); ?> &nbsp;|&nbsp;
                日期:<time datetime="<?php $this->date('c'); ?>" itemprop="datePublished">
                     <?php $this->date('Y年n月j日'); ?>
                     </time>
                <div class="infoNull5"></div>

                <?php $this->content(); ?>

                <div class="infoNull5"></div>
                
                <?php $this->need('comments.php'); ?>
                

            </div>
            
        </div>
        
        <?php $this->need('sidebar.php'); ?>
        
        <div class="infoClear"></div>
        
    </div>
    
    <?php $this->need('footer.php'); ?>
    
</div>
</body>
</html>

9、下面的代码是comments.php

<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>

<div class="post" id="divCommentPost">

<?php $this->comments()->to($comments); ?>

<?php if($this->allow('comment')): ?>

    <p class="posttop">
        <a name="comment" style="font-size:12px;"></a>
        <small><a rel="nofollow" id="cancel-reply" style="display:none;">取消回复</a></small>
    </p>
    
    <form id="comment-form" target="_self" method="post" action="<?php $this->commentUrl() ?>" role="form" >
        <input type="hidden" name="inpId" id="inpId" value="12" />
        <input type="hidden" name="inpArticle" id="inpArticle" value="" />
        <input type="hidden" name="inpRevID" id="inpRevID" value="" />
        
        <p>
        <input type="text" name="author" id="author" class="text" value="<?php $this->remember('author'); ?>" required size="28" tabindex="1" /> 
        <label for="inpName">名称(*)</label>
        </p>
        
        <p>
        <input type="text" name="mail" id="mail" class="text" value="<?php $this->remember('mail'); ?>" <?php if ($this->options->commentsRequireMail): ?> required<?php endif; ?> size="28" tabindex="2"  /> 
        <label for="inpEmail">邮箱(*)</label>
        </p>
        
        <p>
        <input type="text" name="url" id="url" class="text" placeholder="<?php _e('http://'); ?>" value="<?php $this->remember('url'); ?>"  <?php if ($this->options->commentsRequireURL): ?> required<?php endif; ?> size="28" tabindex="3" /> 
        <label for="inpHomePage">网站链接</label>
        </p>
        
        
        
        
        
        <p>
        <textarea name="txaArticle" id="txaArticle" class="text" cols="50" rows="4" tabindex="5" >
            <?php $this->remember('text'); ?>
        </textarea>
        </p>
        
        <p>
        <input name="btnSumbit" type="submit" tabindex="6" value="提交" class="button" /> 
        </p>
                        
        <p style="border-bottom:1px solid #dbe0e6;"></p>
        
        <?php $security = $this->widget('Widget_Security'); ?>
        <input type="hidden" name="_" value="<?php echo $security->getToken($this->request->getReferer())?>">
        
        </form>
        
<?php else: ?>

    <h3><?php _e('评论关闭'); ?></h3>
    
<?php endif; ?>

</div>


<div class="post" id="divCommentList">

<?php if ($comments->have()): ?>
    <h3><?php $this->commentsNum(_t('暂无评论'), _t('仅有一条评论'), _t('已有 %d 条评论')); ?></h3>
    
    <?php $comments->listComments(); ?>

       <?php $comments->pageNav('&laquo; 前一页', '后一页 &raquo;'); ?>
    
<?php endif; ?>

</div>


阅读 3.1k
1 个回答
新手上路,请多包涵
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题