T string parse error

Discussion in 'PHP' started by GLR, Sep 27, 2010.

  1. #1
    Hi all, i'm new to PHP and im getting a T_String parse error on line 3 of this script :

    <?php
    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

    page_header('clubshop');

    $template->set_filenames(array(
        'body' => 'clubshop.html',
    ));

    make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
    page_footer();
    ?>

    I've been looking and looking but i can't see the problem , can anyone help ?

    Thanks !
     
    GLR, Sep 27, 2010 IP
  2. fr33lanc3

    fr33lanc3 Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I put the code on my server and ran it. I am not getting any syntax errors. (I am getting obvious errors on the include, but those wouldnt show if there were syntax errrors) Are you sure the error is coming from this file and not an included file?
     
    fr33lanc3, Sep 27, 2010 IP
  3. GLR

    GLR Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks for replying, when i goto the file in my browser this is the error i get :

    Parse error: syntax error, unexpected T_STRING in /home/hjscc/public_html/clubshop.php on line 3

    I cant see anything wrong so it may be an included file as you say , would it be the root path ?
     
    GLR, Sep 27, 2010 IP
  4. xrvel

    xrvel Notable Member

    Messages:
    918
    Likes Received:
    30
    Best Answers:
    2
    Trophy Points:
    225
    #4
    Try to put your clubshop.php here :)
     
    xrvel, Sep 27, 2010 IP
  5. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #5
    Emm not sure, what is the . for ?

    $phpEx = substr(strrchr(__FILE__, '.'), 1);

    Maybe try it this way

    $phpEx = substr(strrchr(__FILE__) . '.', 1);
     
    MyVodaFone, Sep 27, 2010 IP
  6. xrvel

    xrvel Notable Member

    Messages:
    918
    Likes Received:
    30
    Best Answers:
    2
    Trophy Points:
    225
    #6
    strrchr needs 2 parameters. so the previous code is correct.
     
    xrvel, Sep 27, 2010 IP
  7. GLR

    GLR Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    tried changing it anyway and it still comes up with the same error, i have put clubshop.php in the root folder where my phpbb is.
     
    GLR, Sep 27, 2010 IP
  8. sunlcik

    sunlcik Peon

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    As xrvel said,you should try to put your clubshop.php here.
    Your code what you paster is right.The error is "Parse error: syntax error, unexpected T_STRING in /home/hjscc/public_html/clubshop.php on line 3".
     
    sunlcik, Sep 29, 2010 IP