Parse Error - Total Newbie

I was just given responsibility for all of our WordPress sites and realized that I need a basic understanding of php coding when I encountered this message: ’ Parse error : syntax error, unexpected end of file in /data/17/4/6/106/4332106/user/4988393/htdocs/blog1/wp-content/themes/simplefolio/single.php on line 36

The code is below. Can anyone help identify and explain the problem to me? The line in question reads: <?php comments_template(); ?>.


<?php get_header(); ?>

				<div class="content">
				<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
						$category = sf_get_category_id(get_option('sf_portfolio_category'));
						if (in_category($category) || post_is_in_descendant_category($category)) { include(TEMPLATEPATH . "/template-portfolioitem.php"); $footer = "no"; }
						else {
					<div class="blogpost">
						<div class="comments"><?php comments_number('0', '1', '%'); ?></div>
						<h2 class="title"><?php the_title(); ?></h2>
						<div class="meta">Posted <?php the_time('F jS, Y') ?> in <?php the_category(', ') ?> <?php the_tags( 'and tagged ', ', ', ' '); ?> by <?php the_author() ?></div>
						<div class="entry">
							<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
							<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
					<?php if (get_option('sf_social_status')) { ?>
					<div class="social">
						<h3><?php echo stripslashes(get_option('sf_social_title')); ?></h3>
							<?php echo stripslashes(get_option('sf_social_text')); ?>
							<li class="designfloat"><a href="<?php the_permalink(); ?>&amp;title=<?php the_title_attribute() ?>">DesignFloat</a></li>
							<li class="delicious"><a href="<?php the_permalink(); ?>&amp;title<?php the_title_attribute() ?>">Delicious</a></li>
							<li class="digg"><a href=";url=<?php the_permalink(); ?>&amp;title=<?php the_title_attribute() ?>">Digg</a></li>
							<li class="stumbleupon"><a href="<?php the_permalink(); ?>&amp;title=<?php the_title_attribute() ?>">StumbleUpon</a></li>
							<li class="reddit"><a href="<?php the_permalink(); ?>&amp;title=<?php the_title(); ?>">Reddit</a></li>
							<li class="technorati"><a href="<?php the_permalink(); ?>">Technorati</a></li>
					<?php } ?>
					<?php comments_template(); ?>
					<?php } ?>
					<?php endwhile; else: ?>
							<?php include_once(TEMPLATEPATH."/page-error.php"); ?>
					<?php endif; ?>


<?php if ($footer != "no") { get_sidebar();  } ?>
<?php get_footer(); ?>

“Unexpected end of file” errors usually mean PHP is expecting the end of a block or statement, but has found the end of your file instead. For example:


foreach ([1,2,3] as $num) {
    echo $num;

Gives the error PHP Parse error: syntax error, unexpected end of file in scratch.php on line 5 as PHP expects the foreach loop to close before the end of the file.

There’s nothing wrong with the code you’ve posted; I’d guess your server is running a different copy of the file to what you expect. Try deleting the file from your server then re-uploading it.

Sponsor our Newsletter | Privacy Policy | Terms of Service