SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2007
    Location
    Egypt-Luxor city
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    wordpress problem with index.php template file

    this message appear in home page
    Parse error: syntax error, unexpected T_STRING in C:\wamp\www\wordpress2\wp-content\themes\cypherhackz\index.php on line 14
    here's the code
    Code PHP:
    <?php get_header(); ?>
     
    <div id="main">
     
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
     
     main
     <div class="post_title" id="<?php the_ID(); ?>">
     <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
     </div> <!--close post title-->
     <div class="post_content">
     
    <?php the_content(__(‘Read more…’)); ?>
     
     </div> <!--close post content-->
     
     <div class="post_tag">
     
    <?php the_time(‘F dS, Y’) ?> | <?php the_time(‘h:i a’); ?> | <?php the_category(,) ?> | <?php comments_popup_link(‘No Comments’,1 Comment’,% Comments’); ?> | <?php edit_post_link(‘Edit’,,); ?>
     
    </div> <!--close post tag-->
    <?php comments_template(); ?>
     
    <?php endwhile; else: ?>
     
    Sorry, but you are looking for something that isn‘t here.
     
    <?php endif; ?>
     
     </div> <!--close main -->
     
     
    <?php get_sidebar(); ?>
     
    <?php get_footer(); ?>
    line 14 is
    Code PHP:
    <?php the_content(__(‘Read more…’)); ?>
    any ideas...PLZ

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    Instead of the "angled" single quotes, try using ' (apostrophe/"straight" quote). Although they may be more correct in text, PHP uses quotes for string delimiters in pairs, and a "left" doesn't match a "right".

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2007
    Location
    Egypt-Luxor city
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Instead of the "angled" single quotes, try using ' (apostrophe/"straight" quote). Although they may be more correct in text, PHP uses quotes for string delimiters in pairs, and a "left" doesn't match a "right".
    sorry i don't exactly get what u want plz can u explain more

  4. #4
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are using ‘ and ’ instead of '

  5. #5
    SitePoint Zealot
    Join Date
    Aug 2007
    Location
    Egypt-Luxor city
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are using ‘ and ’ instead of '
    thx so much now i get it

    now the problem massage become

    Parse error: syntax error, unexpected '=' in C:\wamp\www\wordpress2\wp-content\themes\cypherhackz\sidebar.php on line 20
    line 20
    Code PHP:
     <?php the_time('F dS, Y') ?> | <?php the_time('h:i a'); ?> | <?php the_category(', ') ?> | <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> | <?php edit_post_link('Edit',&#8221;,”); ?>

  6. #6
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    I don't see an equal sign in that snippet. Is there one in the few lines before (or after) it? The line number given in the error message does not neccessarily mean that's the line containing the error. Rather, that's the first line the parser knew there was an error.

    Perhaps the last quotes need to be enclosed or escaped (if it is a single double quote and not 2 single quotes)? i.e.
    PHP Code:
    <?php edit_post_link('Edit',&#8221;,'”'); ?>
    PHP Code:
    <?php edit_post_link('Edit',&#8221;,\”); ?>

  7. #7
    SitePoint Zealot
    Join Date
    Aug 2007
    Location
    Egypt-Luxor city
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    u help me so much to solve this problem by following ur advices

    but this code or my index.php template file i take it directly from his tutorial which i get his link from wordpress recommended site
    plz can u know by check the link out if the written code in this page have something wrong or this wrong from me as i newbie

    3)
    Pages' ); ?>
    this appear in the page

    and this the code related to this problem
    Code PHP:
      <?phpwp_list_pages('sort_column=menu_order&title_li=<h2>Pages</h2>' ); ?>

  8. #8
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is no space between '<?php' and 'wp_list_pages'. Here is what it should look like:
    Code php:
    <?php wp_list_pages('sort_column=menu_order&title_li=<h2>Pages</h2>' ); ?>

  9. #9
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    Ah, a tutorial. That explains a lot. WordPress changes "simple" quotes - ' and " into "fancy" quotes. Although they are more gramatically correct for text content, they really mess up code when you copy/paste it.
    I imagine the missing space could be a result of WordPress formatting too.
    Also be on the look out for "weird" characters. The author seems to have done some copy/paste using different character sets, or perhaps it's a result of WordPress changing the 2 dashes -- in the comment tags. i.e.
    PHP Code:
    <!&#226;€“ close main â€“> 
    should be
    PHP Code:
    <!-- close main --> 
    So if you're looking for a simple copy/paste and go type of thing, this will probably give you some troubles. On the other hand, if you're looking to learn, I've found that following tutorials with bugs in them can be very helpful. It requires patience, but you can bet you won't easily make the same mistakes yourself later.

    BTW, this needs a space too
    PHP Code:
    <ul><BR><?phpwp_list_cats( .....


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •