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?!
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?
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
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.
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.
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
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.
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.