Jump to content

Recommended Posts

Hi guys can anyone help me out I installed a new template and I keep getting the following error

 

PHP Parse error: syntax error, unexpected T_ENDIF in /var/www/vhosts/mysite.com/httpdocs/wp-content/themes/Gamenow/header.php on line 130

 

Can anyone tell me how to fix this.

 

Here is the header.php code.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
	<!-- Title -->
	<title><?php wp_title('«', true, 'right'); ?><?php bloginfo('name'); ?></title>

	<!-- Content Type -->
	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

	<!-- Link REL / CSS -->
	<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" />
	<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
	<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

	<!-- Default Style -->
<?php if($_COOKIE['style'] == 'style-light') : ?>
	<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/style-light.css" />
<?php else: ?>
	<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/style-dark.css" />
<?php endif; ?>

	<!-- Light / Dark CSS -->
	<link rel="alternate stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/style-light.css" title="style-light" media="screen" />
	<link rel="alternate stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/style-dark.css" title="style-dark" media="screen" />

	<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
	<?php wp_head(); ?>

	<!-- Javascript -->
	<script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/jquery-1.3.2.min.js"></script>
	<script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/common.js"></script>
</head>
<body>
	<!-- Top -->
	<a name="top" id="top"></a>
	<div class="topbg"></div>

	<!-- Wrapper // -->
	<div class="wrapper">
		<!-- Header // -->
		<div class="header">
			<!-- Logo -->
			<h1><a href="<?php echo get_option('home'); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/img/logo-trans.png" alt="GameNow WP Theme" /></a></h1>

			<!-- Top Links // -->
			<ul class="toplinks">
				<li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon_rss-trans.png" alt="#" /><a href="<?php bloginfo('rss2_url'); ?>">Subscribe</a></li>
				<li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon_bookmark-trans.png" alt="#" /><a href="javascript:bookmark('<?php echo get_option('home'); ?>','<?php echo str_replace("'","\'",get_bloginfo('name')); ?>');">Bookmark</a></li>
				<li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon_twitter-trans.png" alt="" /><a href="http://www.twitter.com/<?php echo get_wpn_config('twitter_username'); ?>">Twitter</a></li>
			</ul>
			<!-- // Top Links -->

			<!-- Search // -->
			<div class="search">
				<form id="searchform" action="<?php echo get_option('home') ?>" />
					<input type="text" name="s" value="Site Search..." onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" />
					<input type="image" src="<?php bloginfo('stylesheet_directory'); ?>/img/spacer.gif" />
				</form>
			</div>
			<!-- // Search -->

			<!-- Buttons -->
			<a class="button button-dark styleswitch" rel="style-dark" href="#">Dark</a>
			<a class="button button-light styleswitch" rel="style-light" href="#">Light</a>

			<!-- Menu // -->
			<ul class="menu">
				<li><a href="<?php echo get_option('home'); ?>">Home</a></li>
				<?php wp_list_pages('sort_column=menu_order&title_li=&depth=0&include='.get_wpn_config('menu_include').'&exclude_tree='.get_wpn_config('menu_exclude')); ?>
			</ul>
			<!-- // Menu -->

			<!-- Submenu // -->
			<ul class="submenu">
				<?php wp_list_categories('sort_column=menu_order&title_li=&depth=0&show_count=0&include='.get_wpn_config('submenu_include').'&exclude='.get_wpn_config('submenu_exclude')); ?>
			</ul>
			<!-- // Submenu -->
		</div>
		<!-- // Header -->

		<?php if(is_home() && !get_query_var('paged')) : ?>
		<!-- Featured / Top Articles // -->
		<div class="ftop">
			<div class="featured">
				<div class="fthumbs">
					<?php $i = 0; $featured = new WP_Query("cat=".get_wpn_config('featured_category_id')."&showposts=5"); while($featured->have_posts()) : $featured->the_post();?>
					<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><img src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" alt="" <?php if($i == 0) echo 'class="active" '; ?>/></a><br />
					<?php $i++; endwhile; $i = 0; ?>
				</div>
				<div class="fwrap">
					<ul>
						<?php $featured = new WP_Query("cat=".get_wpn_config('featured_category_id')."&showposts=5"); while($featured->have_posts()) : $featured->the_post();?>
						<li>
							<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><img src="<?php echo get_post_meta($post->ID, "featured_thumbnail", true); ?>" width="630" height="230" />
							<div>
								<a class="title" href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
								<?php wpn_content_limit(get_the_content(),90); ?>
								<a href="<?php the_permalink(); ?>">more</a>
							</div>
						</li>
						<?php endwhile; ?>
					</ul>
				</div>
			</div>
			<div class="top">
				<span class="heading1"><span>Top Articles</span></span>
				<ul>
				<?php
					$sql = "
						SELECT *
						FROM $wpdb->posts
						WHERE 	post_date_gmt > ".(time()-strtotime('-2 weeks'))." AND post_type = 'post'
						ORDER BY comment_count DESC LIMIT 5
					";

					$top_posts = $wpdb->get_results($sql);

					foreach ($top_posts as $post)  {
						?>
						<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><span><a class="comments" href="<?php the_permalink(); ?>#comments"><?php echo $post->comment_count; ?> Comments</a>Posted Under: <?php the_category(', '); ?></span></li>
						<?
					}
				?>
				</ul>
			</div>
			<div class="clear"></div>
		</div>
		<!-- // Featured / Top Articles -->
		<?php endif; ?>

		<!-- Content // -->
		<div class="content">
			<!--[if lt IE 7]>
			<div style='border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 75px; position: relative;'>
				<div style='position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;'><a href='#' onclick='javascript:this.parentNode.parentNode.style.display="none"; return false;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-cornerx.jpg' style='border: none;' alt='Close this notice'/></a></div>
				<div style='width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;'>
				<div style='width: 75px; float: left;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-warning.jpg' alt='Warning!'/></div>
				<div style='width: 275px; float: left; font-family: Arial, sans-serif;'>
				<div style='font-size: 14px; font-weight: bold; margin-top: 12px;'>You are using an outdated browser</div>
				<div style='font-size: 12px; margin-top: 6px; line-height: 12px;'>For a better experience using this site, please upgrade to a modern web browser.</div>
				</div>
				<div style='width: 75px; float: left;'><a href='http://www.firefox.com' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-firefox.jpg' style='border: none;' alt='Get Firefox 3.5'/></a></div>
				<div style='width: 75px; float: left;'><a href='http://www.browserforthebetter.com/download.html' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-ie8.jpg' style='border: none;' alt='Get Internet Explorer 8'/></a></div>
				<div style='width: 73px; float: left;'><a href='http://www.apple.com/safari/download/' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-safari.jpg' style='border: none;' alt='Get Safari 4'/></a></div>
				<div style='float: left;'><a href='http://www.google.com/chrome' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-chrome.jpg' style='border: none;' alt='Get Google Chrome'/></a></div>
				</div>
			</div>
			<![endif]-->

No offense but that is some seriously messy code. Impossible to follow.

 

       

<?php endif; ?>

That is your offending line but good luck fixing if removing it breaks your application :S.

 

You need to read some guides on abstraction, code readability and best practices. You shouldnt mix HTML with PHP in such a way.

This is not my code this is a template I bought and the guy's I bought it off wont eveny reply to y questions. I have tried getting the answer to this for days now and no one can seem to help. Does anyone have a fix to this.

 

Thanks

I see your predicament, unfortunately these are the things that teach you in life to be extremely cautious of what you purchase and who you purchase it from. A lot of people that hardly know anything about PHP can smash together a simple script thats supposed to do something and sell it and it goes for many products in life :P.

 

As for fixing your code i see you probably dont know much and in these instances for really comlpicated code it is usually having to find a friend who can help you out or finding a cheap freelancer to clean up the code somewhat - and that can be risky as well.

 

Have you tried to remove the offending line?

 

Try this: (Ive removed that last endif; and i have also converted the textual statements to curly braces..

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
      <!-- Title -->
      <title><?php wp_title('«', true, 'right'); ?><?php bloginfo('name'); ?></title>

      <!-- Content Type -->
      <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

      <!-- Link REL / CSS -->
      <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" />
      <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
      <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
      <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

      <!-- Default Style -->
<?php if($_COOKIE['style'] == 'style-light'){ ?>
      <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/style-light.css" />
<?php }else{ ?>
      <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/style-dark.css" />
<?php } ?>

      <!-- Light / Dark CSS -->
      <link rel="alternate stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/style-light.css" title="style-light" media="screen" />
      <link rel="alternate stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/style-dark.css" title="style-dark" media="screen" />

      <?php if ( is_singular() ){ wp_enqueue_script( 'comment-reply' ); } ?>
      <?php wp_head(); ?>

      <!-- Javascript -->
      <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/jquery-1.3.2.min.js"></script>
      <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/common.js"></script>
   </head>
   <body>
      <!-- Top -->
      <a name="top" id="top"></a>
      <div class="topbg"></div>

      <!-- Wrapper // -->
      <div class="wrapper">
         <!-- Header // -->
         <div class="header">
            <!-- Logo -->
            <h1><a href="<?php echo get_option('home'); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/img/logo-trans.png" alt="GameNow WP Theme" /></a></h1>

            <!-- Top Links // -->
            <ul class="toplinks">
               <li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon_rss-trans.png" alt="#" /><a href="<?php bloginfo('rss2_url'); ?>">Subscribe</a></li>
               <li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon_bookmark-trans.png" alt="#" /><a href="javascript:bookmark('<?php echo get_option('home'); ?>','<?php echo str_replace("'","\'",get_bloginfo('name')); ?>');">Bookmark</a></li>
               <li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon_twitter-trans.png" alt="" /><a href="http://www.twitter.com/<?php echo get_wpn_config('twitter_username'); ?>">Twitter</a></li>
            </ul>
            <!-- // Top Links -->

            <!-- Search // -->
            <div class="search">
               <form id="searchform" action="<?php echo get_option('home') ?>" />
                  <input type="text" name="s" value="Site Search..." onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" />
                  <input type="image" src="<?php bloginfo('stylesheet_directory'); ?>/img/spacer.gif" />
               </form>
            </div>
            <!-- // Search -->

            <!-- Buttons -->
            <a class="button button-dark styleswitch" rel="style-dark" href="#">Dark</a>
            <a class="button button-light styleswitch" rel="style-light" href="#">Light</a>

            <!-- Menu // -->
            <ul class="menu">
               <li><a href="<?php echo get_option('home'); ?>">Home</a></li>
               <?php wp_list_pages('sort_column=menu_order&title_li=&depth=0&include='.get_wpn_config('menu_include').'&exclude_tree='.get_wpn_config('menu_exclude')); ?>
            </ul>
            <!-- // Menu -->

            <!-- Submenu // -->
            <ul class="submenu">
               <?php wp_list_categories('sort_column=menu_order&title_li=&depth=0&show_count=0&include='.get_wpn_config('submenu_include').'&exclude='.get_wpn_config('submenu_exclude')); ?>
            </ul>
            <!-- // Submenu -->
         </div>
         <!-- // Header -->

         <?php if(is_home() && !get_query_var('paged')){ ?>
         <!-- Featured / Top Articles // -->
         <div class="ftop">
            <div class="featured">
               <div class="fthumbs">
                  <?php $i = 0; $featured = new WP_Query("cat=".get_wpn_config('featured_category_id')."&showposts=5"); while($featured->have_posts()){ $featured->the_post();?>
                  <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><img src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" alt="" <?php if($i == 0){ echo 'class="active" '; } ?>/></a><br />
                  <?php $i++; } $i = 0; ?>
               </div>
               <div class="fwrap">
                  <ul>
                     <?php $featured = new WP_Query("cat=".get_wpn_config('featured_category_id')."&showposts=5"); while($featured->have_posts()){ $featured->the_post();?>
                     <li>
                        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><img src="<?php echo get_post_meta($post->ID, "featured_thumbnail", true); ?>" width="630" height="230" />
                        <div>
                           <a class="title" href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
                           <?php wpn_content_limit(get_the_content(),90); ?>
                           <a href="<?php the_permalink(); ?>">more</a>
                        </div>
                     </li>
                     <?php } ?>
                  </ul>
               </div>
            </div>
            <div class="top">
               <span class="heading1"><span>Top Articles</span></span>
               <ul>
               <?php
                  $sql = "
                     SELECT *
                     FROM $wpdb->posts
                     WHERE    post_date_gmt > ".(time()-strtotime('-2 weeks'))." AND post_type = 'post'
                     ORDER BY comment_count DESC LIMIT 5
                  ";

                  $top_posts = $wpdb->get_results($sql);

                  foreach ($top_posts as $post)  {
                     ?>
                     <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><span><a class="comments" href="<?php the_permalink(); ?>#comments"><?php echo $post->comment_count; ?> Comments</a>Posted Under: <?php the_category(', '); ?></span></li>
                     <?
                  }
               ?>
               </ul>
            </div>
            <div class="clear"></div>
         </div>
         <!-- // Featured / Top Articles -->

         <!-- Content // -->
         <div class="content">
            <!--[if lt IE 7]>
            <div style='border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 75px; position: relative;'>
               <div style='position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;'><a href='#' onclick='javascript:this.parentNode.parentNode.style.display="none"; return false;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-cornerx.jpg' style='border: none;' alt='Close this notice'/></a></div>
               <div style='width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;'>
               <div style='width: 75px; float: left;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-warning.jpg' alt='Warning!'/></div>
               <div style='width: 275px; float: left; font-family: Arial, sans-serif;'>
               <div style='font-size: 14px; font-weight: bold; margin-top: 12px;'>You are using an outdated browser</div>
               <div style='font-size: 12px; margin-top: 6px; line-height: 12px;'>For a better experience using this site, please upgrade to a modern web browser.</div>
               </div>
               <div style='width: 75px; float: left;'><a href='http://www.firefox.com' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-firefox.jpg' style='border: none;' alt='Get Firefox 3.5'/></a></div>
               <div style='width: 75px; float: left;'><a href='http://www.browserforthebetter.com/download.html' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-ie8.jpg' style='border: none;' alt='Get Internet Explorer 8'/></a></div>
               <div style='width: 73px; float: left;'><a href='http://www.apple.com/safari/download/' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-safari.jpg' style='border: none;' alt='Get Safari 4'/></a></div>
               <div style='float: left;'><a href='http://www.google.com/chrome' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-chrome.jpg' style='border: none;' alt='Get Google Chrome'/></a></div>
               </div>
            </div>
            <![endif]-->

 

hope this helps

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.