解析错误:语法错误,文件意外结尾 - 第 59 行


Parse error: syntax error, unexpected end of file - line 59

Wordpress中激活修改的主题时会出现此错误:

解析错误:

语法错误,C:''xampp''htdocs''wp-content''themes''manifest_v1.1''functions.php 第 59 行中文件意外结束

功能.php文件已被修改,以允许在发布评论时选择"主题"行。

这是代码:

<?php
$cats=array(
1=>'Category 1',
2=>'Category 2',
3=>'Category 3'
);
function showCats($cats){
?>
<select name="commentCats">
<?php
foreach($cats as $key=>$cat){
?>
<option value="<?php print $key; ?>"><?php print $cat; ?></option>
<?
}
?>
</select>
<?php
}
add_action ('comment_post', 'add_comment_fields', 1);
function add_comment_fields($comment_id) {
            add_comment_meta($comment_id, 'commentCats', $_POST['commentCats'], true);
}
function manifest_comment($comment, $args, $depth){
print $depth;
global $cats;
 $catID = get_comment_meta(get_comment_ID(),"commentCats", true);
 $GLOBALS['comment'] = $comment; ?>
   <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
     <div id="comment-<?php comment_ID(); ?>">
      <div class="comment-author vcard">
         <?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>
         <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'),         get_comment_author_link()) ?>
      </div>
      <?php if ($comment->comment_approved == '0') : ?>
         <em><?php _e('Your comment is awaiting moderation.') ?></em>
         <br />
      <?php endif; ?>
      <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'  ','') ?></div>
      <?php if($catID){ ?>
      <h3><?php 
      print $cats[$catID]; ?></h3>
    <?php } ?>
      <?php comment_text() ?>
      <div class="reply">
         <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
      </div>
     </div>
<?php 
} 
?>

无法弄清楚问题是什么,我被告知它正在另一台测试机器上工作。我目前正在本地计算机上测试主题。我正在使用XAMPP(http://www.apachefriends.org/en/xampp-windows.html)进行测试,其中包括Apache,MySQL,PHP和PHPmyAdmin。我正在使用Wordpress版本3.4.1的全新安装。

谢谢!

第 36 行 - 您在通话后忘记了;

<?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'),         get_comment_author_link()) ?>

编辑:正如我从评论中看到的,并进一步查看 eclipse 中的代码,您在语句之后缺少很多;

<?php comment_text() ?>
<?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>