WordPress.org

Ready to get started?Download WordPress

Forums

Getting Parse error: syntax error, unexpected ' (3 posts)

  1. ftpioro
    Member
    Posted 1 year ago #

    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. ]

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

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

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head profile="http://gmpg.org/xfn/11">
    
    	<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(); ?>
    </head>
    <body>
    	<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', ' | ', ''); ?>
    					</p>
    				</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>
    			</div>
    		<?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>
    <ul>
    						<?php wp_list_cats("sort_column=name&optioncount=1&hierarchical=0"); ?>
    					</ul>
    </li>
    <li><h2><?php _e("Archives"); ?></h2>
    <ul>
    					<?php wp_get_archives("type=monthly"); ?>
    				</ul>
    </li>
       		<?php get_links_list(); ?>
    		</ul>
    <!--close unordered list-->
    	</div><!--end sidebar-->
    </body>
    </html>

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

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

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

    <?php
    <form>
     ...
    ?>
  3. ftpioro
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags