1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Parse error: syntax error, unexpected $end ??

Discussion in 'PHP' started by z80039, Oct 25, 2008.

  1. #1
    I have installed a wordpress theme on my wordpress site and I am getting this error for the comments :
    Parse error: syntax error, unexpected $end in /****/****/public_html/wp-content/themes/genius/comments.php on line 124

    here is the code :

    
    <?php // Do not delete these lines
    	if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    		die ('Please do not load this page directly. Thanks!');
    
            if (!empty($post->post_password)) { // if there's a password
                if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
    				?>
    
    				<p class="nocomments">This post is password protected. Enter the password to view comments.<p>
    
    				<?php
    				return;
                }
            }
    
    		/* This variable is for alternating comment background */
    		$oddcomment = 'odd';
    ?>
    
    <!-- You can start editing here. -->
    
    <?php if ($comments) : ?>
    
    <?php 
    
    	/* Count the totals */
    	$numPingBacks = 0;
    	$numComments  = 0;
    
    	/* Loop through comments to count these totals */
    	foreach ($comments as $comment) {
    		if (get_comment_type() != "comment") { $numPingBacks++; }
    		else { $numComments++; }
    	}
    
    ?>
    
    <?php 
    
    	/* This is a loop for printing comments */
    	if ($numComments != 0) : ?>
    	<h3 id="comments"><?php comments_number('No Comments', 'One Comment', '% Comments' );?> on &#8220;<?php the_title(); ?>&#8221;</h3> 
    
    	<ol class="commentlist">
    
    	<?php foreach ($comments as $comment) : ?>
    
    		<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
    			<cite><?php comment_author_link() ?></cite> |<span class="postmeta"><a href="#comment-<?php comment_ID() ?>" title="">
    			<?php comment_date('F jS, Y') ?>
    at
    <?php comment_time() ?>
    			</a>
                <?php edit_comment_link('edit','',''); ?>
    			</span> 
    		  <?php if ($comment->comment_approved == '0') : ?>
    			<em>Your recent comment is awaiting moderation!</em>
    			<?php endif; ?>
    			<br />
    			<?php comment_text() ?>
    		</li>
    
    	<?php /* Changes every other comment to a different class */
    		if ('alt' == $oddcomment) $oddcomment = '';
    		else $oddcomment = 'alt';
    	?>
    
    	<?php endforeach; /* end for each comment */ ?>
    	</ol>
    
     <?php else : // this is displayed if there are no comments so far ?>
    
      <?php if ('open' == $post->comment_status) : ?> 
    		<!-- If comments are open, but there are no comments. -->
    
    	 <?php else : // comments are closed ?>
    		<!-- If comments are closed. -->
    		<p class="nocomments">Comments are closed now!</p>
    
    	    <?php endif; ?>
    <?php endif; ?>
    
    
    <?php if ('open' == $post->comment_status) : ?>
    
    <h3 id="respond">Leave a Reply</h3>
    
    <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p>
    <?php else : ?>
    
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    
    <?php if ( $user_ID ) : ?>
    
    <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout &raquo;</a></p>
    
    <?php else : ?>
    
    <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
    <label for="author">Name <?php if ($req) echo "(required)"; ?></label></p>
    
    <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
    <label for="email">Email (will not be published) <?php if ($req) echo "(required)"; ?></label></p>
    
    <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
    <label for="url">Blog or Website </label>
    </p>
    
    <?php endif; ?>
    
    <p>
      <textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea>
    </p>
    <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    </p>
    <?php do_action('comment_form', $post->ID); ?>
    
    </form>
    
    <?php endif; // If registration required and not logged in ?>
    
    <?php endif; // if you delete this the sky will fall on your head ?>
    PHP:
    Thanks
    in advance
     
    z80039, Oct 25, 2008 IP
  2. Agent_Smith

    Agent_Smith Well-Known Member

    Messages:
    890
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    145
    #2
    <?php endif; // If registration required and not logged in ?>
    
    <?php endif; // if you delete this the sky will fall on your head ?> 
    PHP:
    TO

    <?php 
    endif; 
    endif;
    ?>
    PHP:
     
    Agent_Smith, Oct 25, 2008 IP
    z80039 likes this.
  3. Calon

    Calon Peon

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Just thought I'd let you know that if you experience this error again, it's because you've opened something and not closed it.

    EXAMPLE:

    if( $itunes == 'betterthanwmp' ) { 
     echo 'I think so!';
    
    PHP:
    It's missing a }

    But in your case, you've started <?php and haven't ended it.

    By the way, the problem is that the ?> is commented by the //
     
    Calon, Oct 25, 2008 IP
    z80039 likes this.
  4. Kyosys

    Kyosys Peon

    Messages:
    226
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well actually, you did end it, but you commented out the end.
     
    Kyosys, Oct 25, 2008 IP
    z80039 likes this.
  5. Calon

    Calon Peon

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I said that.. ^_^
     
    Calon, Oct 25, 2008 IP
  6. Kyosys

    Kyosys Peon

    Messages:
    226
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Oh... yeah. I missed that last sentence of yours
     
    Kyosys, Oct 25, 2008 IP
  7. z80039

    z80039 Well-Known Member

    Messages:
    517
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    130
    #7
    thanks all, REP added
     
    z80039, Oct 28, 2008 IP