Parse error: syntax error, unexpected $end - what does that mean?

I have been trying to find the solution to this: Parse error: syntax error, unexpected $end, which says it is on line 68. Line 68 is the last line. I have given up with finding the solution to the error, so could someone please help me with this? Thanks in advance.


<?php
/*
Template Name: Comments
*/
?>

<?php

// Do not delete these lines
    if (!empty($_SERVER['SCRIPT_FILENAME']) &&
    'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) {
        die ('Please do not load this page directly. Thanks!');
    }

    if ( post_password_required() ) { ?>
        <p>This post is password protected. 
        Enter the password to view comments.</p>
        return;
    }
?>


<!-- Display the comments -->
<?php function alternate_rows($i) {
        if ($i % 2) :
            echo ' class="alt"';
        else :
?>

<?php if ($comments) : ?>
    <ol class="commentlist">
        <?php foreach ($comments as $comment) : ?>
            <?php $i++; ?>
            <li<?php alternate_rows($i); ?> id="comment-<?php comment_ID(); ?>">
            <li class="<?php if (comment_author_email == "mail@the-ultimate-website-blog.com") { echo 'author'; } else { echo $oddcomment; } ?> item" id="comment-">

                <?php if ($comment->comment_approved == '0') : ?>
                    <p>Your comment is awaiting approval.</p>
                <?php endif; ?>

                <cite><?php comment_type(); ?> by <?php comment_author_link(); ?> on <?php comment_date(); ?> at <?php comment_time(); ?></cite>
                <?php comment_text(); ?>
            </li>
            </li>
        <?php endforeach; ?>
        </ol>
        
    <?php else : ?>

        <p>No comments yet.</p>

    <?php endif; ?>

    <?php endif; ?>
<?php } ?>

<!-- Display the comment form -->
<?php if (comments_open()) : ?>

    <br /><br />

    <?php comment_form(); ?>

<?php else : ?>

    <?php echo 'Comments are closed.'; ?>

<?php endif; ?>

Line 19.


    if ( post_password_required() ) { ?>
        <p>This post is password protected.
        Enter the password to view comments.</p>
        return;
    }
?>
 

That ending brace has a <? missing in front of it. Therefore php thinks you have one brace too many.

Also please don’t be offended but with the number of opening and closing tags you have all over the place for php I’m not surprised you couldn’t find the problem. You might want to consider doing your php in one file and then insert it into a template instead. It makes it much neater and easier to understand.