Results 1 to 6 of 6

Thread: PHP Parse error: syntax error, unexpected T_STRING

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Posts
    352

    PHP Parse error: syntax error, unexpected T_STRING

    Hi, I am getting the above mentioned error when I change the HTML text from within a PHP define statement. Im a newbie in this feild , may I know what may be causing this error and how it may be avoided.Thanks

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: PHP Parse error: syntax error, unexpected T_STRING

    Post the code please.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Posts
    352

    Re: PHP Parse error: syntax error, unexpected T_STRING

    Here it is: -
    Code:
    define('STRING_GREETINGS', '<h1>Welcome to My Online Store!</h1>
    <p>This online store is powered by <a href="http://www.shop-script.com/php-shopping-cart-software-1.html">
    Shop-Script FREE shopping cart software</a>.<br />
    Shop-Script FREE is lite PHP shopping cart solution that allows you to create your own online store. Shop-Script FREE comes with fully open source code, and is free to use and modify.
    <p>This text is editable.<br />
    To edit open file <b>languages/english.php</b> in your text editor (e.g. Notepad).</p>');
    Lets say I want to do something like change Welcome to my online store, to Goodbye from my online store, I get this message. However when I restore original code the error disapears.

  4. #4
    Addicted Member
    Join Date
    Mar 2005
    Posts
    157

    Re: PHP Parse error: syntax error, unexpected T_STRING

    Can you do that with a defined variable?
    Last edited by Jaquio; Nov 5th, 2007 at 08:23 AM.

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: PHP Parse error: syntax error, unexpected T_STRING

    Putting HTML into variables is generally a bad idea, as is using echo to output the bulk of the document.

    If you have some HTML that is common to several pages, put it in its own file and include() it.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Posts
    352

    Re: PHP Parse error: syntax error, unexpected T_STRING

    Okay Thanks, I willwork on that . Cheers

Posting Permissions

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



Click Here to Expand Forum to Full Width