View Full Version : PHP Layout/Includes


Coconut99
04-20-2003, 01:24 PM
I just took a tutorial on how to make a PHP-based layout with includes, so the content is included in the page instead of the layout. I thought I did it right, but when I uploaded it I got a parse error:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/virtual/site140/fst/var/www/html/index2.php on line 7

Parse error: parse error in /home/virtual/site140/fst/var/www/html/index2.php on line 7


I don't think there is anything wrong with line 7. Here's my code:

<html>
<head>
<title>TITLE</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="#333333" alink="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<?php
print "<table width=\"780"\ border=\"0"\ cellpadding=\"0"\ cellspacing=\"0"\>/n";
print "<tr bgcolor=\"#E9EEFF"\>/n";
print "<td height=\"175"\ colspan=\"3"\><div align=\"center"\>/n";
print "<p><img src=\"IMAGE.gif"\ width=\"780"\ height=\"175"\></p>/n";
print "</div></td>/n";
print "</tr>\n";
print "<tr bgcolor=\"#FFFFCC"\>\n";
print "<td height="\30\" colspan="\3\">&nbsp;</td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"125"\ height=\"365"\ bgcolor=\"#FFFFCC"\><div align=\"center"\>\n";
print "Menu\n";
print "</div></td>\n";
print "<td width=\"530"\ height=\"365"\ valign=\"top"\><h3 align=\"right"\><font size=\"3"\ face=\"Verdana, Arial, Helvetica, sans-serif"\>include($page);</font></h3>\n";
print "</td>\n";
print "<td width=\"125"\ height=\"365"\ bgcolor=\"#FFFFCC"\><div align=\"center"\>\n";
print "Extra\n";
print "</div></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td height=\"30"\ colspan=\"3"\ bordercolor=\"#000000"\ bgcolor=\"#FFFFFF"\><div align=\"center"\><font size="1" face=\"Verdana, Arial, Helvetica, sans-serif"\>Copyright\n";
print "&copy; 2003 Laughing Otter</font></div></td>\n";
print "</tr>\n";
print "</table>\n";
?>
</body>
</html>

Line 7 is the one with the table info.

The tutorial said to put print " at the beginning of each line and \n"; at the end of each line. Does that include <html>, <head>, etc.? Please help! Thanks!

pb&j
04-20-2003, 04:35 PM
it looks like you are escaping the second quotes after they happen...

this...
width=\"780"\

should be...
width=\"780\"

and that goes for all of the values.

also make sure your endings are...
\n
instead of
/n