Support » Themes and Templates » Getting Parse error: syntax error, unexpected '

  • ftpioro


    I am trying to create my own theme and I get this error message
    Parse error: syntax error, unexpected ‘<‘ in C:\xampp\htdocs\wordpress\wp-content\themes\Tutorial\searchform.php on line 2 in the searchform.php. Here is the code for searchform.php

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser. ]

    <form method="get" id="searchform" action="<?php bloginfo('home');?>/">
    <input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" size="15" />
    <input type="submit" id="searchsubmit" value="Search" />

    The code that calls the searchform is on line 49 of the following code.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <head profile="">
    	<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
    	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    	<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->
    	<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    	<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
    	<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
    	<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
    	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    	<?php wp_get_archives('type=monthly&format=link'); ?>
    	<?php //comments_popup_script(); // off by default ?>
    	<?php wp_head(); ?>
    	<div id="header">
    		<h1><a href="”<?php">”><?php bloginfo(‘name’); ?></a></h1>
    		<?php bloginfo(‘description’); ?>
    	</div><!--end header-->
    	<div id="container">
    		<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    			<div class=”post”>
    				<h2><a href="”<?php">” title=”<?php the_title(); ?>”><?php the_title(); ?></a></h2>
    				<div class=”entry”>
    					<?php the_content(); ?>
    					<p class="postmetadata"><?php _e('Filed under:'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?>
    					<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?>
    				</div><!--end entry-->
    			</div><!--end post-->
    			<?php endwhile; ?>
    				<div class=”navigation”>
    					<?php posts_nav_link("in between","before","after"); ?>
    				</div><!--end navigation-->
       		<?php else : ?>
    				<div class=”post” id=”post-<?php the_ID(); ?>”>
    				<h2><?php _e("Not Found"); ?></h2>
    		<?php endif; ?>
      </div><!--end container-->
      <div class=”sidebar”>
    <ul><!-–open unordered list-->
      		<li id=”search”>
    				<?php include(TEMPLATEPATH . "/searchform.php"); ?>
      		<?php wp_list_pages("depth=3&title_li=<h2>Pages</h2>"); ?>
    <li><h2><?php _e("Categories"); ?></h2>
    						<?php wp_list_cats("sort_column=name&optioncount=1&hierarchical=0"); ?>
    <li><h2><?php _e("Archives"); ?></h2>
    					<?php wp_get_archives("type=monthly"); ?>
       		<?php get_links_list(); ?>
    <!--close unordered list-->
    	</div><!--end sidebar-->

    I have looked over the code many times and cannot find the problem.
    Need some help please.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Andrew Nevins


    Forum moderator

    You can’t have HTML within PHP unless you’re converting it to a string.




    Knew it had to a simple problem. Couldn’t see the forest because of the trees. Took the php tags off and it worked like a charm.

    Thank You.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting Parse error: syntax error, unexpected '’ is closed to new replies.