Php Help

Discussion in 'Gaming' started by XMasterX, Dec 22, 2005.

  1. XMasterX

    XMasterX Well-Known Member

    Age:
    40
    Posts:
    5,336
    Likes Received:
    0
    Joined:
    Aug 1, 2005
    Location:
    Wisconsin, USA
    I get this error:

    Code:
    Parse error: parse error, unexpected ':' in /home/vintage/public_html/pcnerds/index2.
    heres my code... where do you see a ':' ?

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
    	background-image: url(images/bg.jpg);
    }
    -->
    </style></head>
    
    <body>
    <table width="100%" height="100%" border="1">
      <tr>
        <td colspan="3"> <? include:("header.php") ?> </td>
      </tr>
      <tr>
        <td width="95"> <? include:("nav.php") ?> </td>
        <td width="512" colspan="2"></td>
      </tr>
    </table>
    </body>
    </html>
    
    help?!
     
  2. AndrewR.

    AndrewR. Well-Known Member

    Age:
    34
    Posts:
    1,831
    Likes Received:
    0
    Joined:
    Aug 6, 2005
    Location:
    Scottsdale, Arizona
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <style type="text/css">
    body{
    background-image: url(images/bg.jpg);
    }
    </style>
    </head>
    
    <body>
    <table width="100%" border="1">
     <tr>
       <td colspan="3"> <? include ('header.php') ?> </td>
     </tr>
     <tr>
       <td width="95"> <? include ('nav.php') ?> </td>
       <td width="512" colspan="2"></td>
     </tr>
    </table>
    </body>
    </html>
    It is now valid XHTML 1.0.

    But also, where will you put your conent and such?
     
  3. Equivalent Exchange

    Equivalent Exchange Well-Known Member

    Posts:
    1,466
    Likes Received:
    0
    Joined:
    Nov 9, 2005
    yeah, this kinda thing "<? include:("header.php") ?>"

    should be <?php include("header.php"); ?>

    and same with the other one

    (putting <?php in instead is also a good habit to get into)


    Edit: aaaaand chronic beats me to it, lol
     
  4. AndrewR.

    AndrewR. Well-Known Member

    Age:
    34
    Posts:
    1,831
    Likes Received:
    0
    Joined:
    Aug 6, 2005
    Location:
    Scottsdale, Arizona
    For the include, it isnt what you said.

    It is <? include ('file.php'); ?>

    or

    <? include 'file.php'; ?>

    But yeah, the <?php should be used in most cases.
     
  5. XMasterX

    XMasterX Well-Known Member

    Age:
    40
    Posts:
    5,336
    Likes Received:
    0
    Joined:
    Aug 1, 2005
    Location:
    Wisconsin, USA
    yeah, I had <? include:('file.php'); ?>

    i now have <? include ('file.php'); ?>

    thanks, bleh
     
  6. AndrewR.

    AndrewR. Well-Known Member

    Age:
    34
    Posts:
    1,831
    Likes Received:
    0
    Joined:
    Aug 6, 2005
    Location:
    Scottsdale, Arizona
    Did you copy and paste my code? If you did, it should be ready to upload. I already validated it for Xhtml so you are ready to go.

    If you have any other questions for HTML, PHP, or CSS, feel free to ask me.
     
  7. Equivalent Exchange

    Equivalent Exchange Well-Known Member

    Posts:
    1,466
    Likes Received:
    0
    Joined:
    Nov 9, 2005
    I use the way I did and it works fine for me. whitespaces for the most part dont count in many programming languages, so "include ("file")" is the same as "include("file")". Same thing for the quotes I beleive. I've interchanged them without anything happaning
     
  8. AndrewR.

    AndrewR. Well-Known Member

    Age:
    34
    Posts:
    1,831
    Likes Received:
    0
    Joined:
    Aug 6, 2005
    Location:
    Scottsdale, Arizona
    Never knew that. Whenever I read the PHP manuals or whatever, they always use single quotes and using a space. Oh well, good to know that. Thanks.
     
  9. Equivalent Exchange

    Equivalent Exchange Well-Known Member

    Posts:
    1,466
    Likes Received:
    0
    Joined:
    Nov 9, 2005
    Spacing is a lot of the time really good for keeping code neat and clean. In my programming class I've seen kids who use almost no spaces whatsoever, and their code is almost impossible to debug when something almost surely doesnt work. Its all a matter of preference and how you want your code to look.

    I think (not exactly sure, but pretty sure) you can write an entire code on one line and have it work fine, doesnt matter how long it is.
     
  10. XMasterX

    XMasterX Well-Known Member

    Age:
    40
    Posts:
    5,336
    Likes Received:
    0
    Joined:
    Aug 1, 2005
    Location:
    Wisconsin, USA
    yep, you can write it all on one line. it's just a headache when you have to edit it...
     

Share This Page