User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,610 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,507 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1835 | Replies: 22
Reply
Join Date: Nov 2007
Posts: 10
Reputation: tattie is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
tattie tattie is offline Offline
Newbie Poster

Help T_STRING error? i cant find it

  #1  
Nov 10th, 2007
Hey guys im really new to php and i had it all worked out untill this came along

it says this

Parse error: syntax error, unexpected T_STRING in /home/tattie/public_html/index.php on line 1

i really really dont know what to do and i would be so grateful if someone could tell me what is wrong

here is the code

<!--THIS INCLUDES HEADER.PHP--><? php get_header(); ?><!-- END -->

<div class="side"><?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Thanks Kubrick for this code ?>

<?php if (is_category()) { ?>
<h3><?php _e('Archive for '); echo single_cat_title(); ?></h3>

<?php } elseif (is_day()) { ?>
<h3><?php _e('Archive for '); the_time('F j, Y'); ?></h3>

<?php } elseif (is_month()) { ?>
<h3><?php _e('Archive for '); the_time('F, Y'); ?></h3>

<?php } elseif (is_year()) { ?>
<h2><?php _e('Archive for '); the_time('Y'); ?></h2>

<?php } elseif (is_author()) { ?>
<h3><?php _e('Author Archive'); ?></h3>

<?php } elseif (is_search()) { ?>
<h3><?php _e('Search Results'); ?></h3>
<?php } ?>
<?php while (have_posts()) : the_post(); ?>

<!--TITLE TAG-->
<h1><?php the_title(); ?></h1>
<!--END-->


<!--TIME DATE CATEGORY WORDS-->
<h2><?php the_time('F jS, Y'); ?> by <?php the_author(); ?>  &nbsp;  <?php comments_popup_link(__('0 Comments'), __('1 Comment'), __('% Comments'), 'commentslink', __('sorry, Comments off for this post.')); ?> &nbsp;  <BR>
Filed Under: <?php the_category(', ') ?> &nbsp;
</h2>
<!--END-->

<?php if (is_search()) { ?>
<?php the_excerpt() ?>
<?php } else { ?>
<?php the_content(__('Read more »')); ?>


<!--COMMENTS TAG-->

<!--END-->
<br /> <br />

<?php comments_template(); // Get wp-comments.php template ?>

<?php } ?>

<!--
<?php trackback_rdf(); ?>
-->

<?php endwhile; ?>
<?php posts_nav_link('', __(''), __('&laquo; Previous entries')); ?>
<?php posts_nav_link('  ', __(''), __('')); ?>
<?php posts_nav_link('', __('Next entries &raquo;'), __('')); ?>

<?php else : ?>
<h3><?php _e('Not Found'); ?></h3>
<p><?php _e('Sorry, but no posts matched your criteria.'); ?></p>
<?php endif; ?>
</div>

<!--THIS INCLUDES FOOTER.PHP-->
<?php get_footer(); ?><!-- END --> 
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2007
Location: Morrisdale, PA
Posts: 52
Reputation: JeniF is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 5
JeniF's Avatar
JeniF JeniF is offline Offline
Junior Poster in Training

Re: T_STRING error? i cant find it

  #2  
Nov 10th, 2007
<div class="side"><?php if (have_posts()) : ?>
Notice the : after posts())
change this to ;
I keep hitting "escape", but I'm still here!!!!
:}
Reply With Quote  
Join Date: Nov 2007
Posts: 10
Reputation: tattie is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
tattie tattie is offline Offline
Newbie Poster

Re: T_STRING error? i cant find it

  #3  
Nov 10th, 2007
thanks so much bit it is still not working

http://www.janetjackson.org.uk it still shows the same message
Reply With Quote  
Join Date: Aug 2007
Location: Morrisdale, PA
Posts: 52
Reputation: JeniF is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 5
JeniF's Avatar
JeniF JeniF is offline Offline
Junior Poster in Training

Re: T_STRING error? i cant find it

  #4  
Nov 10th, 2007
Look through code for additional errors as notated between lines
////////////////
///////////////

Originally Posted by tattie View Post
Hey guys im really new to php and i had it all worked out untill this came along

it says this

Parse error: syntax error, unexpected T_STRING in /home/tattie/public_html/index.php on line 1

i really really dont know what to do and i would be so grateful if someone could tell me what is wrong

here is the code

<!--THIS INCLUDES HEADER.PHP--><? php get_header(); ?><!-- END -->
/////////////
Above make sure you chnge <? php to <?php   note no spacing
///////////////
<div class="side"><?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Thanks Kubrick for this code ?>

<?php if (is_category()) { ?>
/////////////
Above need to end your php with a ; ?>
//////////////////
<h3><?php _e('Archive for '); echo single_cat_title(); ?></h3>

<?php } elseif (is_day()) { ?>
/////////////
Above need to end your php with a ;?>
///////////
<h3><?php _e('Archive for '); the_time('F j, Y'); ?></h3>

<?php } elseif (is_month()) { ?>
/////////////
Above need to end your php with a ;?>
//////////////////
<h3><?php _e('Archive for '); the_time('F, Y'); ?></h3>

<?php } elseif (is_year()) { ?>
/////////////
Above need to end your php with a ;?>
///////////////
<h2><?php _e('Archive for '); the_time('Y'); ?></h2>

<?php } elseif (is_author()) { ?>
/////////////
Above need to end your php with a ;?>
/////////////
<h3><?php _e('Author Archive'); ?></h3>

<?php } elseif (is_search()) { ?>
/////////////
Above need to end your php with a ;?>
//////////////
<h3><?php _e('Search Results'); ?></h3>
<?php } ?>
<?php while (have_posts()) : the_post(); ?>
/////////////////////////////////////////////////////////////////
Look above here, once again you have a : instead of an ;
/////////////////////////////////////////////////////////////////
<!--TITLE TAG-->
<h1><?php the_title(); ?></h1>
<!--END-->


<!--TIME DATE CATEGORY WORDS-->
<h2><?php the_time('F jS, Y'); ?> by <?php the_author(); ?>  &nbsp;  <?php comments_popup_link(__('0 Comments'), __('1 Comment'), __('% Comments'), 'commentslink', __('sorry, Comments off for this post.')); ?> &nbsp;  <BR>
Filed Under: <?php the_category(', ') ?> &nbsp;
/////////////
Above need to end your php with a ;?>
///////////////
</h2>
<!--END-->

<?php if (is_search()) { ?>
/////////////
Above need to end your php with a ;?>
///////////////
<?php the_excerpt() ?>
/////////////
Above need to end your php with a ;?>
////////////////
<?php } else { ?>
/////////////
Above need to end your php with a ;?>
///////////////
<?php the_content(__('Read more »')); ?>


<!--COMMENTS TAG-->

<!--END-->
<br /> <br />

<?php comments_template(); // Get wp-comments.php template ?>

<?php } ?>
/////////////
Above need to end your php with a ;?>
///////////////
<!--
<?php trackback_rdf(); ?>
-->

<?php endwhile; ?>
<?php posts_nav_link('', __(''), __('&laquo; Previous entries')); ?>
<?php posts_nav_link('  ', __(''), __('')); ?>
<?php posts_nav_link('', __('Next entries &raquo;'), __('')); ?>

<?php else : ?>
////////////////////
Above once again using a : instead of ;
////////////////

<h3><?php _e('Not Found'); ?></h3>
<p><?php _e('Sorry, but no posts matched your criteria.'); ?></p>
<?php endif; ?>
</div>

<!--THIS INCLUDES FOOTER.PHP-->
<?php get_footer(); ?><!-- END --> 
Last edited by JeniF : Nov 10th, 2007 at 2:48 pm. Reason: additional error correction
I keep hitting "escape", but I'm still here!!!!
:}
Reply With Quote  
Join Date: Nov 2007
Location: Arkansas
Posts: 416
Reputation: buddylee17 will become famous soon enough buddylee17 will become famous soon enough 
Rep Power: 3
Solved Threads: 81
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro in Training

Re: T_STRING error? i cant find it

  #5  
Nov 10th, 2007
Get rid of the space in between <? and php on line1. i.e replace
<? php get_header(); ?>
with
<?php get_header(); ?>
Last edited by buddylee17 : Nov 10th, 2007 at 2:37 pm.
Reply With Quote  
Join Date: Nov 2007
Posts: 10
Reputation: tattie is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
tattie tattie is offline Offline
Newbie Poster

Re: T_STRING error? i cant find it

  #6  
Nov 10th, 2007
right ok i think i have most of it fixed..here is the new code

<!--THIS INCLUDES HEADER.PHP--><?php get_header() ;?><!-- END -->

<div class="side"><?php if (have_posts()) ;?>
<?php $post = $posts[0]; // Thanks Kubrick for this code ;?>

<?php if (is_category()) { ;?>
<h3><?php _e('Archive for '); echo single_cat_title() ;?></h3>
<?php } elseif (is_day()) { ;?>
<h3><?php _e('Archive for '); the_time('F j, Y') ;?></h3>

<?php } elseif (is_month()) { ;?>
<h3><?php _e('Archive for '); the_time('F, Y') ;?></h3>

<?php } elseif (is_year()) { ;?>
<h2><?php _e('Archive for '); the_time('Y') ;?></h2>

<?php } elseif (is_author()) { ;?>
<h3><?php _e('Author Archive') ;?></h3>

<?php } elseif (is_search()) { ;?>
<h3><?php _e('Search Results') ;?></h3>
<?php } ;?>
<?php while (have_posts()) ; the_post() ;?>

<!--TITLE TAG-->
<h1><?php the_title() ;?></h1>
<!--END-->


<!--TIME DATE CATEGORY WORDS-->
<h2><?php the_time('F jS, Y'); ;?> by <?php the_author(); ;?>  &nbsp;  <?php comments_popup_link(__('0 Comments'), __('1 Comment'), __('% Comments'), 'commentslink', __('sorry, Comments off for this post.')) ;?> &nbsp;  <BR>
Filed Under: <?php the_category(', ') ;?> &nbsp;
</h2>
<!--END-->

<?php if (is_search()) { ;?>
<?php the_excerpt() ;?>
<?php } else { ;?>
<?php the_content(__('Read more »'));?>


<!--COMMENTS TAG-->

<!--END-->
<br /> <br />

<?php comments_template(); // Get wp-comments.php template ;?>

<?php } ;?>

<!--
<?php trackback_rdf() ;?>
-->

<?php endwhile: ?>
<?php posts_nav_link('', __(''), __('&laquo; Previous entries')): ?>
<?php posts_nav_link('  ', __(''), __('')): ?>
<?php posts_nav_link('', __('Next entries &raquo;'), __('')): ?>

<?php else ; ?>
<h3><?php _e('Not Found'); ?></h3>
<p><?php _e('Sorry, but no posts matched your criteria.'); ?></p>
<?php endif; ?>
</div>

<!--THIS INCLUDES FOOTER.PHP-->
<?php get_footer(); ?><!-- END -->

it says its wrong on line 55 but i cant see it

here if 55 btw
<?php endwhile: ?>
Reply With Quote  
Join Date: Nov 2007
Location: Arkansas
Posts: 416
Reputation: buddylee17 will become famous soon enough buddylee17 will become famous soon enough 
Rep Power: 3
Solved Threads: 81
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro in Training

Re: T_STRING error? i cant find it

  #7  
Nov 10th, 2007
Try endwhile; on line 55. Note the semicolon instead of the colon
Last edited by buddylee17 : Nov 10th, 2007 at 7:37 pm.
Reply With Quote  
Join Date: Nov 2007
Posts: 10
Reputation: tattie is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
tattie tattie is offline Offline
Newbie Poster

Re: T_STRING error? i cant find it

  #8  
Nov 10th, 2007
i have tried that as well and its still not working

its really weird it was working fine a few weeks ago and then the whole thing kinda died
Reply With Quote  
Join Date: Nov 2007
Location: Arkansas
Posts: 416
Reputation: buddylee17 will become famous soon enough buddylee17 will become famous soon enough 
Rep Power: 3
Solved Threads: 81
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro in Training

Re: T_STRING error? i cant find it

  #9  
Nov 10th, 2007
Found your problem. You are starting the while loop with a semicolon instead of a colon. It's unusual to see while: and endwhile; in php. Most of us just use braces. Anyway here's what you need to do:

line 23: <?php while (have_posts()): the_post() ;?>
Also make sure 55 has the semicolon.

Also
Line 3 should be: <?php if (have_posts()) :?>
and
Line 60 should be: <?php ; else: ?>
Last edited by buddylee17 : Nov 10th, 2007 at 8:45 pm.
Reply With Quote  
Join Date: Nov 2007
Posts: 10
Reputation: tattie is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
tattie tattie is offline Offline
Newbie Poster

Re: T_STRING error? i cant find it

  #10  
Nov 10th, 2007
thanks sooo much i have fixed most on it

now on line 60 it says there is somthing wrong

<?php else ;?>
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 7:15 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC