Jump to content

Archived

This topic is now archived and is closed to further replies.

tomfmason

Unexpected '<'

Recommended Posts

I am sure that this is a simple syntax error but I get the following error when I run my test.php script:

[b]Parse error[/b]: parse error, unexpected '<' in [b]C:\htdocs\users\www\owpt\header.php[/b] on line 2

here is my header.php file:

[code]<?php
<div class="fixcenter">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr class="header">
    <td valign="middle"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="770" height="200" align="top">
            <param name="movie" value="/images/header.swf">
            <param name="quality" value="high"><param name="LOOP" value="false">
            <embed src="images/header.swf" width="790" height="200" loop="false" align="top" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed></object>
    </td>
  </tr>
</table>
?>[/code]

I am knew to php and realy have no idea if I am doing this right. Any Ideas would be great.

Share this post


Link to post
Share on other sites
Remove the <?php and ?> from the beginning and end of your file. Or, put an echo statement around all of your html.

There is no php in there, but you have it wrapped in php tags.

Share this post


Link to post
Share on other sites
I followed the [a href=\"http://www.phpfreaks.com/tutorials/8/1.php\" target=\"_blank\"]Theme Tutorial[/a]. And yet I get this same error with the footer

Share this post


Link to post
Share on other sites
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
<?php
<div class="fixcenter">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr class="header">
<td valign="middle"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="770" height="200" align="top">
<param name="movie" value="/images/header.swf">
<param name="quality" value="high"><param name="LOOP" value="false">
<embed src="images/header.swf" width="790" height="200" loop="false" align="top" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed></object>
</td>
</tr>
</table>
?>
[/quote]
Your page doesn't have any actual PHP in it. All it is is HTML with a "<?php" before it and a "?>" after it.
You could do one of the following to make it display correctly, without the warning:

1. Eliminate the <?php and ?>. Since there is no PHP contained within them, they serve no purpose
[code]<div class="fixcenter">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr class="header">
    <td valign="middle"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="770" height="200" align="top">
            <param name="movie" value="/images/header.swf">
            <param name="quality" value="high"><param name="LOOP" value="false">
            <embed src="images/header.swf" width="790" height="200" loop="false" align="top" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed></object>
    </td>
  </tr>
</table>[/code]

2. Use echo to display the HTML
[code]<?php
echo "<div class=\"fixcenter\">\n";
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n";
...
echo "</table>\n";
?>[/code]

The second one prints the HTML using PHP. The end result is exactly the same as the first one, making it pointless (unless you plan on adding PHP to the script later). If you echo a string ("<div class=\"fixcenter\">\n"), you have to escape the quotes that contain the string. So for this, since the string is contained in double quotes you have to escape all double quotes. That means you have to put a \ in front of any double quotes.
\n is a line break. If you don't use that, all the HTML will be on the same line when the page is loaded.

Share this post


Link to post
Share on other sites
or you could just do this:

[code]

<?php

print <<<END
<div class="fixcenter">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr class="header">
    <td valign="middle"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="770" height="200" align="top">
            <param name="movie" value="/images/header.swf">
            <param name="quality" value="high"><param name="LOOP" value="false">
            <embed src="images/header.swf" width="790" height="200" loop="false" align="top" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed></object>
    </td>
  </tr>
</table>
END;

?>

[/code]

but if your not going to write any php then it doesn't make sense. of course now the above code has some php in it [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.