Jump to content

Parse Error - Refers to tags??


zxfactor

Recommended Posts

Hi Everyone, Could anyone tell me what I'm doing wrong to have genereated the following error:

Parse error: syntax error, unexpected '>' in C:\xampp\htdocs\wordpress\wp-content\themes\tutorial\single.php on line 22  :(

 

Here is a copy of my code:

 

<?php get_header(); ?>


<div id="container">


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


	<div class="post" id="post-<?php the_ID(); ?>">


	<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>


	<div class="entry">


	<?php the_content(); ?>


	<?php link_pages('<p> '<strong>Pages:</strong>‘, </p>’, ‘number’); ?>


	<p class="postmetadata">

<?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?>



	</p>


	</div>


	</div>


<?php endwhile; ?>

	<div class="navigation">

		<?php previous_post_link('&laquo,%link') ?><?php next_post_link('%link &raquo,') ?>

('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> <?php edit_post_link('Edit', ' &#124; ', ''); ?>

	</div>


<?php else : ?>


	<div class="post">


		<h2><?php_e('Not Found'); ?></h2>


	</div>


<?php endif; ?>

</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

Link to comment
Share on other sites

You start and end PHP code way too much.

 

This is sitting out by itself

 

('No Comments »', '1 Comment »', '% Comments »'); ?>

 

 

I removed the following code -

('No Comments »', '1 Comment »', '% Comments »'); ?> and left  <?php edit_post_link('Edit', ' &#124; ', ''); ?>

 

and I still get the error for line 22

Link to comment
Share on other sites

You're  using "smart quotes" instead of regular quotes. Change

<?php link_pages('<p> '<strong>Pages:</strong>‘, </p>’, ‘number’); ?>

to

<?php link_pages('<p><strong>Pages:</strong>', '</p>', 'number'); ?>

 

(I think)

Ken

Link to comment
Share on other sites

You're  using "smart quotes" instead of regular quotes. Change

<?php link_pages('<p> '<strong>Pages:</strong>‘, </p>’, ‘number’); ?>

to

<?php link_pages('<p><strong>Pages:</strong>', '</p>', 'number'); ?>

 

(I think)

Ken

 

kenrbnsn - Thanks for the recommendation, after making the changes, I still get the same error message, referring to line 22?

 

 

Link to comment
Share on other sites

Thanks for responding...

 

 

This is my index code (index.php)

 

<?php get_header(); ?>


<div id="container">


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


	<div class="post" id="post-<?php the_ID(); ?>">


	<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>


	<div class="entry">


	<?php the_content(); ?>


	<p class="postmetadata">

<?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?><br />

<?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> <?php edit_post_link('Edit', ' &#124; ', ''); ?>

	</p>


	</div>


	</div>


<?php endwhile; ?>

	<div class="navigation">

		<?php posts_nav_link(); ?>

	</div>


<?php else : ?>


	<div class="post">


		<h2><?php_e('Not Found'); ?></h2>


	</div>


<?php endif; ?>

</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

</body>

</html>

 

 

and this is the page the code refers to in line 22 (single.php)

 

<?php get_header(); ?>


<div id="container">


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


	<div class="post" id="post-<?php the_ID(); ?>">


	<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); 

?></a></h2>


	<div class="entry">


	<?php the_content(); ?>


	<?php link_pages('<p><strong>Pages:</strong>‘, '</p>’, ‘number’); ?>


	<p class="postmetadata">

<?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?>



	</p>


	</div>


	</div>


<?php endwhile; ?>

	<div class="navigation">

		<?php previous_post_link('&laquo,%link') ?><?php next_post_link('%link &raquo,') 

?>



	</div>


<?php else : ?>


	<div class="post">


		<h2><?php_e('Not Found'); ?></h2>


	</div>


<?php endif; ?>

</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

 

 

Link to comment
Share on other sites

You still have the weird quotes in this line:

<?php link_pages('<p><strong>Pages:</strong>‘, '</p>’, ‘number’); ?>

You need to use plain single quotes

<?php link_pages('<p><strong>Pages:</strong>', '</p>', 'number'); ?>

 

Ken

Link to comment
Share on other sites

okay.. I just realized that correct page.php instead of single.phh..however even with the correction made to single.php, I still get the following error message:

 

Parse error: syntax error, unexpected '/' in C:\xampp\htdocs\wordpress\wp-content\themes\tutorial\single.php on line 22

 

This happens when I click on the tile of post.. if that helps any...

Link to comment
Share on other sites

Sorry.. here is the corrected code..

 

the index php

 

<?php get_header(); ?>


<div id="container">


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


	<div class="post" id="post-<?php the_ID(); ?>">


	<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>


	<div class="entry">


	<?php the_content(); ?>


	<p class="postmetadata">

<?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?><br />

<?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> <?php edit_post_link('Edit', ' &#124; ', ''); ?>

	</p>


	</div>


	</div>


<?php endwhile; ?>

	<div class="navigation">

		<?php posts_nav_link(); ?>

	</div>


<?php else : ?>


	<div class="post">


		<h2><?php_e('Not Found'); ?></h2>


	</div>


<?php endif; ?>

</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

</body>

</html>

 

 

 

 

 

the single php.. that the error refers to

 

<?php get_header(); ?>


<div id="container">


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


	<div class="post" id="post-<?php the_ID(); ?>">


	<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>


	<div class="entry">


	<?php the_content(); ?>


	<?php link_pages('<p><strong>Pages:</strong>‘, '</p>’, ‘number’); ?>


	<p class="postmetadata">

<?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?>



	</p>


	</div>


	</div>


<?php endwhile; ?>

	<div class="navigation">

		<?php previous_post_link('&laquo,%link') ?><?php next_post_link('%link &raquo,') ?>

			<?php edit_post_link('Edit', ' &#124; ', ''); ?>

	</div>


<?php else : ?>


	<div class="post">


		<h2><?php_e('Not Found'); ?></h2>


	</div>


<?php endif; ?>

</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

 

 

 

the page php

 

<?php get_header(); ?>


<div id="container">


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


	<div class="post" id="post-<?php the_ID(); ?>">


	<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>


	<div class="entry">


	<?php the_content(); ?>


	<?php linl_pages('<p><strong>Pages:</strong>','</p>','number'); ?>


	<?php edit_post_link('Edit','<p>','</p>'); ?>


	</div>


<?php endwhile; ?>


<?php else : ?>


	<div class="post">


		<h2><?php_e('Not Found'); ?></h2>


	</div>


<?php endif; ?>

</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

</body>

</html>

 

 

Link to comment
Share on other sites

You STILL have not changed the weird quotes in this line

<?php link_pages('<p><strong>Pages:</strong>‘, '</p>’, ‘number’); ?>

to single quotes

<?php link_pages('<p><strong>Pages:</strong>', '</p>', 'number'); ?>

 

PHP does not recognize the characters and as quotes. What editor are you using to develop your code?

 

Ken

Link to comment
Share on other sites

Okay ... that is so strange.. not sure what was going on.. but once I copied and pasted your code .. as opposed to typing it myself... that seem to resolve the problem... Thanks you so much for taking the time to continue to look at my issue. I really do appreciated it. Do you have a suggestion for a better editor?

Link to comment
Share on other sites

Do you have a suggestion for a better editor?

 

Take a look at this thread for editor suggestions.

 

I've used Dreamweave (expensive), Eclipse (free), NetBeans (Free), and UltraEdit (not free, but not too expensive). You should get an editor that does syntax checking and highlighting of syntax.

 

Ken

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.