doulikegingers Posted January 15, 2009 Share Posted January 15, 2009 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 More sharing options...
Zephyr_Pure Posted January 15, 2009 Share Posted January 15, 2009 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 More sharing options...
Mark Baker Posted January 15, 2009 Share Posted January 15, 2009 It's not easy to make PHP both unreadable and unintelligible, but you seem to have managed it. What does your if do? What does your while do? What do any of your functions do? Link to comment https://forums.phpfreaks.com/topic/140931-php-syntax-error/#findComment-737626 Share on other sites More sharing options...
doulikegingers Posted January 15, 2009 Author Share Posted January 15, 2009 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 More sharing options...
doulikegingers Posted January 15, 2009 Author Share Posted January 15, 2009 I go the issue sorted. I had not ended the if and while functions. I have however now, got another issue. Thanks, for the help with this. Even tho it was completely caused by own stupidit Link to comment https://forums.phpfreaks.com/topic/140931-php-syntax-error/#findComment-737641 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.