Results 1 to 5 of 5

Thread: HELP! unexpected T_LNUMBER

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Location
    Ohio
    Posts
    153

    HELP! unexpected T_LNUMBER

    Hi, when I try and run some code if gives me this error...

    Parse error: parse error, unexpected T_LNUMBER in added.php on line 4
    Here is the php code i'm using...

    <?php
    $da = getdate();
    $date="$da[weekday] $da[mday] $da[month] $da[year]";
    $news = ("<table border="0" width="94%" id="table10" cellspacing="0" cellpadding="0"

    height="136">
    <tr>
    <td valign="top" height="15" width="10">
    <img border="0" src="images/navs/tlc.gif" width="10" height="15">
    </td>
    <td valign="top" height="15" background="images/navs/tm.gif">
    </td><td valign="top" height="15" width="10">
    <img border="0" src="images/navs/trc.gif" width="10" height="15">
    </td>
    </tr><tr>
    <td valign="top" width="10" background="images/navs/tlt.gif">
    </td>
    <td valign="top">
    <table border="3" width="100%" id="table11" cellspacing="0" cellpadding="0"

    height="100%" bordercolordark="#222931" bordercolorlight="#413F52">
    <tr>
    <td height="26" background="images/navs/toptblbg.gif">
    <div align="center">
    <table border="0" width="98%" id="table14" cellspacing="0" cellpadding="0">
    <tr>
    <td width="189">
    <b>
    <font face="Arial" size="2">$title</font></b></td>
    <td align="right">
    <b>
    <font face="Arial" size="2">$date</font></b></td>
    </tr>
    </table></div>
    </td>
    </tr><tr>
    <td valign="top">$news</td></tr>
    <tr>
    <td height="24" background="images/navs/toptblbg.gif">
    <div align="center">
    <table border="0" width="98%" id="table15" cellspacing="0" cellpadding="0">
    <tr>
    <td><b>
    <font face="Arial" size="2">Posted by $posted</font></b></td>
    </tr>
    </table>
    </div>
    </td></tr>
    </table>
    </td>
    <td valign="top" width="10" background="images/navs/trt.gif"></td>
    </tr>
    <tr>
    <td valign="top" height="12" width="10">
    <img border="0" src="images/navs/blc.gif" width="10" height="12"></td>
    <td valign="top" height="12" background="images/navs/btm.gif"></td>
    <td valign="top" height="12" width="10">
    <img border="0" src="images/navs/brc.gif" width="10" height="12"></td>
    </tr>
    </table>
    <br>");

    $file = fopen("news.php", "r");
    $read = fread($file, filesize("news.php"));
    fclose($file);
    $blah = fopen("news.php", "w");
    $news=stripslashes($news);
    fwrite($blah, "$news $read");
    fclose ($blah);
    print "<meta http-equiv=\"refresh\"

    content=\"1;http://mywebsite.com/\">";
    ?>
    I think I need to do something to that html in the variable? Please help!

    Thanks in advance

  2. #2
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    Re: HELP! unexpected T_LNUMBER

    $news = ("<table border="0" width="94%"

    I would remove the ( mark and then take out all the quotes and make the either ' (single quotes) or no quote at all. When I am setting HTML into variables, I use a single ' mark because PHP sees each " as a start and end point.

    VB Code:
    1. <?php
    2. $da = getdate();
    3. $date="$da[weekday] $da[mday] $da[month] $da[year]";
    4. $news = "<table border='0' width='94%' id='table10' cellspacing='0' cellpadding='0'
    5.  
    6. height='136'>
    7. <tr>
    8. <td valign='top' height='15' width='10'>
    9. <img border='0' src='images/navs/tlc.gif' width='10' height='15'>
    10. </td>
    11. <td valign='top' height='15' background='images/navs/tm.gif'>
    12. </td><td valign='top' height='15' width='10'>
    13. <img border='0' src='images/navs/trc.gif' width='10' height='15'>
    14. </td>
    15. </tr><tr>
    16. <td valign='top' width='10' background='images/navs/tlt.gif'>
    17. </td>
    18. <td valign='top'>
    19. <table border='3' width='100%' id='table11' cellspacing='0' cellpadding='0'
    20.  
    21. height='100%' bordercolordark='#222931' bordercolorlight='#413F52'>
    22. <tr>
    23. <td height='26' background='images/navs/toptblbg.gif'>
    24. <div align='center'>
    25. <table border='0' width='98%' id='table14' cellspacing='0' cellpadding='0'>
    26. <tr>
    27. <td width='189'>
    28. <b>
    29. <font face='Arial' size='2'>$title</font></b></td>
    30. <td align='right'>
    31. <b>
    32. <font face='Arial' size='2'>$date</font></b></td>
    33. </tr>
    34. </table></div>
    35. </td>
    36. </tr><tr>
    37. <td valign='top'>$news</td></tr>
    38. <tr>
    39. <td height='24' background='images/navs/toptblbg.gif'>
    40. <div align='center'>
    41. <table border='0' width='98%' id='table15' cellspacing='0' cellpadding='0'>
    42. <tr>
    43. <td><b>
    44. <font face='Arial' size='2'>Posted by $posted</font></b></td>
    45. </tr>
    46. </table>
    47. </div>
    48. </td></tr>
    49. </table>
    50. </td>
    51. <td valign='top' width='10' background='images/navs/trt.gif'></td>
    52. </tr>
    53. <tr>
    54. <td valign='top' height='12' width='10'>
    55. <img border='0' src='images/navs/blc.gif' width='10' height='12'></td>
    56. <td valign='top' height='12' background='images/navs/btm.gif'></td>
    57. <td valign='top' height='12' width='10'>
    58. <img border='0' src='images/navs/brc.gif' width='10' height='12'></td>
    59. </tr>
    60. </table>
    61. <br>";
    62.  
    63. echo $news;
    64. ?>
    I used this and it worked fine
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: HELP! unexpected T_LNUMBER

    Actually, it's a stupid idea in the first place to put all the HTML code into a PHP string. Aside from the quote issue, it also probably hinders syntax highlighting.
    Then it's not a particularly good idea to modify a PHP file from a script. You can get permission problems with that, and it's unsafe, too. If you have to write a static file, at least give it a html extension.
    That said, I see nothing wrong with dynamically generating the file. Unless you don't have a database available. In which case it would still be better to write the news entries into a terse XML file and process and output that instead. (XSLT processing is an option.)

    If you HAVE to do it your way, at least use HEREDOC syntax for the string:
    Code:
    $news = <<END
    <table> ...
    </table>
    END;
    Do I even need to comment on how horribly 1992 your HTML is?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Location
    Ohio
    Posts
    153

    Re: HELP! unexpected T_LNUMBER

    Hey! Don't blame me, blame FrontPage !

    I never really spent much time learning HTML. How would you make HTML up to date though? lol

    or.. Can you make websites intirely from PHP, no HTML needed?

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: HELP! unexpected T_LNUMBER

    I blame you for using FrontPage.

    No, PHP always has to emit HTML (or something else that the browser can interpret, but HTML is the best supported.)
    But the point is that you should learn HTML and CSS. Then you can code it properly. By hand.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

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