Jump to content


Photo

Unexpected '<'


  • Please log in to reply
4 replies to this topic

#1 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 25 June 2006 - 02:26 PM

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

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

here is my header.php file:

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

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

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 25 June 2006 - 02:29 PM

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.

#3 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 25 June 2006 - 02:40 PM

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

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#4 johnnyk

johnnyk
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 26 June 2006 - 02:13 AM

[!--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.macr...rsion=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.macromedi...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
<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>

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

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.
Rediscover the Web:
<a href="http://www.spreadfir...;t=219"></a><br />

#5 Drumminxx

Drumminxx
  • Members
  • PipPipPip
  • Advanced Member
  • 92 posts
  • LocationUSA

Posted 26 June 2006 - 02:49 AM

or you could just do this:


<?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;

?>


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\" /]


:: gucci.com ::
:: blockbuster.com ::

--------------------




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users