My eyes must not be working today, as I cannot see the error here:
I'm getting the error on the <div> line. That's the exact code snippet, not retyped.PHP Code:$brag = '';
echo <<< EOF
<div id="rightcolumn">
| SitePoint Sponsor |





My eyes must not be working today, as I cannot see the error here:
I'm getting the error on the <div> line. That's the exact code snippet, not retyped.PHP Code:$brag = '';
echo <<< EOF
<div id="rightcolumn">
Mike
It's not who I am underneath, but what I do that defines me.





uh, don't you need?PHP Code:echo '<<< EOF
<div id="rightcolumn">';
- website





No, and there is more HTML after the <div> line anyhoo.
And to those that will ask, yes, the ending token is there.
Mike
It's not who I am underneath, but what I do that defines me.





well, this is a bit small coding bit, doesn't say very much...
...only thing I can think is that the " is affecting the string, in that case doing \" would solve the case...
hope that helps!
- website





It shouldn't be that, as heredoc echos parse variables and quotes just fine.
I don't really want to resort to normal echos using a bunch of \t 's for my formatting :|
Mike
It's not who I am underneath, but what I do that defines me.





hmm, I see, not familiar with these advanced echo's :|
Why not simply use
etc... ?PHP Code:?><div id="rightcolumn"><?
but one thought though, shouldn't the EOF be right after the >>> ? no space ?
>>>EOF
Still this is wierd as I thought the php interprenter ignored whitespace... ...propably not in echo lines though...
Just some thoughts though.
- website





Space doesn't matter :\
Mike
It's not who I am underneath, but what I do that defines me.





Here's the full code, if it helps you at all.
PHP Code:function pc_whb_right($pagename, $subpage)
{
// $news = include('./content/news.inc.php');
// $stats = include('./content/stats.inc.php');
$brag = '';
echo <<<END
<div id="rightcolumn">
<table width="200" cellpadding="0" cellspacing="0" bgcolor="#FFE0B3" style="border: 1px solid #2142FF;">
<tr>
<td>
<img src="img/rcolumn-news.gif" width="200" height="30" />
<div class="right-news">{$news}</div>
<img src="img/rcolumn-stats.gif" width="200" height="30" />
<div class="right-ststs">{$stats}</div>
<img src="img/rcolumn-brag.gif" width="200" height="30" />
<div class="right-brag">{$brag}</div>
</td>
</tr>
</table>
</div>
END;
}
Mike
It's not who I am underneath, but what I do that defines me.





Am I to understand that that you don't need quotes before <<<END and after END;?
Does it change anything if you place the starting <<<END on the line directly below the "echo"?
John





Oh, commenting out the entire echo statement still gives a parse error :|
Mike
It's not who I am underneath, but what I do that defines me.





Originally Posted by PHP John
From my post above, I don't think it's the echo statement breaking, but no, you don't need quotes for a heredoc type echo statement. Yes, the <<< and token have to be on the same line, AFAIK.
Mike
It's not who I am underneath, but what I do that defines me.





I just took your code changed it this way:
Other than a few undefined variables it ran just fine.PHP Code:<?php
// $news = include('./content/news.inc.php');
// $stats = include('./content/stats.inc.php');
$brag = '';
echo <<<END
<div id="rightcolumn">
<table width="200" cellpadding="0" cellspacing="0" bgcolor="#FFE0B3" style="border: 1px solid #2142FF;">
<tr>
<td>
<img src="img/rcolumn-news.gif" width="200" height="30" />
<div class="right-news">{$news}</div>
<img src="img/rcolumn-stats.gif" width="200" height="30" />
<div class="right-ststs">{$stats}</div>
<img src="img/rcolumn-brag.gif" width="200" height="30" />
<div class="right-brag">{$brag}</div>
</td>
</tr>
</table>
</div>
END;
?>
There have been times when I get this error, and can't find ANYTHING that causes it. In the end I retype it, and it works. It's like there is some control character that gets inserted somewhere.
Maybe try copying your own code from here back in to your script and trying it again?
John





Heh, no dice
I've retyped it twice, and tried your code. No matter what type of echo I do, or how many new lines/tabs/spaces I put somewhwere, it always errors on the <div> line.
Mike
It's not who I am underneath, but what I do that defines me.





PHP John, check the echo in the manual, I just found this out too
once again I must say that php allows too much...
I don't know the solution to your problem but why not just swith out of php mode ?> ?
- website





That is very strange, because like I said, other than undefined variables it worked just fine on my machine...![]()
John





Even this gives the error
PHP Code:function pc_whb_right($pagename, $subpage)
{
echo 'test';
/**
// $news = include('./content/news.inc.php');
// $stats = include('./content/stats.inc.php');
$brag = '';
echo <<<END
<div id="rightcolumn">
<table width="200" cellpadding="0" cellspacing="0" bgcolor="#FFE0B3" style="border: 1px solid #2142FF;">
<tr>
<td>
<img src="img/rcolumn-news.gif" width="200" height="30" />
<div class="right-news">{$news}</div>
<img src="img/rcolumn-stats.gif" width="200" height="30" />
<div class="right-ststs">{$stats}</div>
<img src="img/rcolumn-brag.gif" width="200" height="30" />
<div class="right-brag">{$brag}</div>
</td>
</tr>
</table>
</div>
END;
**/
}
Mike
It's not who I am underneath, but what I do that defines me.





Script is here by the way:
http://www.webhostboast.com/test.php
Mike
It's not who I am underneath, but what I do that defines me.
I think there are some non-breaking spaces in there, as when I deleted the last one, and replaced the echo <<< with a breaking space it worked.
did you copy it from a browser somewhere?
Who walks the stairs without a care
It shoots so high in the sky.
Bounce up and down just like a clown.
Everyone knows its Slinky.





This worked just fine, as well:
PHP Code:<?php
function pc_whb_right($pagename, $subpage)
{
// $news = include('./content/news.inc.php');
// $stats = include('./content/stats.inc.php');
$brag = '';
echo <<<END
<div id="rightcolumn">
<table width="200" cellpadding="0" cellspacing="0" bgcolor="#FFE0B3" style="border: 1px solid #2142FF;">
<tr>
<td>
<img src="img/rcolumn-news.gif" width="200" height="30" />
<div class="right-news">{$news}</div>
<img src="img/rcolumn-stats.gif" width="200" height="30" />
<div class="right-ststs">{$stats}</div>
<img src="img/rcolumn-brag.gif" width="200" height="30" />
<div class="right-brag">{$brag}</div>
</td>
</tr>
</table>
</div>
END;
}
pc_whb_right("foo", "bar");
?>![]()
John





Originally Posted by cyborg from dh
Nope, all typed up.
Mike
It's not who I am underneath, but what I do that defines me.





Originally Posted by PHP John
Yeah, that worked fine for me :|
Mike
It's not who I am underneath, but what I do that defines me.





Go figure...
I'm guessing it is something above this function.
Will you post the code above it?
John





Pardon me while I flip out like a ninja
Thanks for your help guys.
Mike
It's not who I am underneath, but what I do that defines me.





Care to let us in on what it was?![]()
John





include("file.php');
in the function above it.
![]()
Mike
It's not who I am underneath, but what I do that defines me.
Bookmarks