Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Oct 2007
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    parse error, unexpected '<'

    I wrote some php code that produces an error and having checked over and over again I just cannot figure out what the problem is.

    The error is: "parse error, unexpected '<' in blabla.php on line 143". On that line I have this:
    Code:
    $addedheadertext = "<p style=\"margin-left:3px;\"><img src=\"".<?php echo $mosConfig_live_site; ?>."/images/logo.gif\" border=\"0\" width=\"165\" height=\"87\" alt=\"logo\"><br><br><b>Emailing: <a href=\"".<?php echo $articlefullversionurl; ?>."\">".<?php echo $mainframe->getPageTitle(); ?>."</a> (© ".<?php echo $year; ?>." <a href=\"http://".<?php echo $mosConfig_sitename; ?>."\">".<?php echo $mosConfig_sitename; ?>."</a>)<br>Full page url: <a href=\"".<?php echo $articlefullversionurl; ?>."\">".<?php echo $articlefullversionurl; ?>."</a></b><br><br></p>";
    First I thought that the use of single quotation marks was the issue so I replaced those by escaped double quotation marks but that did not help. I also checked all the dots and it seems each < has a matching >.

    What have I overlooked?

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    You have <?php ?> tags in your string.. you need to remove those and the echo function.
    PHP Code:
    $string "words " $variable " more words"

  • #3
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,036
    Thanks
    2
    Thanked 316 Times in 308 Posts
    Edit: Basically says the same as above ^^^ Two great minds with almost identical answers...

    You are already in PHP mode. Remove all the <?php echo ; ?> from inside the string and just leave the variable names -

    PHP Code:
    $your_string "abc" $variable_here "def"
    Last edited by CFMaBiSmAd; 11-20-2007 at 01:22 AM. Reason: too slow on the post button
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Copy-cat!

  • #5
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,036
    Thanks
    2
    Thanked 316 Times in 308 Posts
    I was surprised that the code example we came up with was that similar.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #6
    New Coder
    Join Date
    Oct 2007
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks to both of you!
    Like the best place to hide is in plain view this is so obvious that I never saw it!


  •  

    Posting Permissions

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