Jump to content

PHP Syntax Error


doulikegingers

Recommended Posts

Hi Guys, 

 

Any help with the following problem, would be greatly appreciated.  I reckon, It's becuase I'm doing stupid.

 

I'm getting the following error:

Parse error: syntax error, unexpected $end in /home/voxdcouk/public_html/wb/wp-content/themes/wolffnew/index.php on line 44

 

However, Line 44 reads:  </html> 

 

I read that the error is possibly caused when I don't close php tags properly.  however, I've double checked the code, and can't see if I have or not.   

 

Here's the code:

 

<?php get_header(); ?> 

<?php if (have_posts()); ?> <br /> 
<?php while (have_posts()) : the_posts(); ?> 

<h2 id="post-<?php the_ID(); ?>"> 
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent link to <?php the_title();?>"> 
<?php the_title(); ?> </a> </h2>  
<small> <?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --> </small> 


</div>
</div> 
<?php get_footer(); ?> 

 

Does anyone have ideas to what the problem might be?

 

Thanks,

 

 

Glenn.

Link to comment
https://forums.phpfreaks.com/topic/140931-php-syntax-error/
Share on other sites

Unexpected $end at the end of a document usually means that you forgot to close a conditional block with a bracket.  There aren't any errors of that sort in that page of code you posted, so do any of those functions you're calling do any includes?  Have you checked the includes for missing brackets?

Link to comment
https://forums.phpfreaks.com/topic/140931-php-syntax-error/#findComment-737625
Share on other sites

Yeah okay.  I know very little of PHP.  Very little.    I'm following what is set out in the wordpress codex.   

 

Found at the top of the default index.php template file is the starting code for The Loop.

 

<?php if (have_posts()) : ?><br />

<?php while (have_posts()) : the_post(); ?>

 

  1. First it checks whether any posts were collected with the have_posts() function.

  2. If there are any posts, a PHP while loop is started. A while loop will continue to execute as long as the condition in the parenthesis is logically true. So as long as the function have_posts() returns a true value, The Loop will keep going.

  3. The function have_posts() simply checks the next item in the collection of posts: if there's another item, return true; if there is no next item, return false.

 

 

Link to comment
https://forums.phpfreaks.com/topic/140931-php-syntax-error/#findComment-737636
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.