Jump to content

Unexpected '<'


tomfmason

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.
Link to comment
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.
Link to comment
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\" /]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.