Re: syntax error or notepad++ error? [message #182826 is a reply to message #182811] |
Mon, 16 September 2013 18:40 |
J.O. Aho
Messages: 194 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 16/09/13 15:20, richard wrote:
> All is well with matching divisions in notepad++ until I enter this code:
>
> echo "<div class='bcol2'>";
> echo "* ".$number." *<br />";
> echo '<a
> href="http://mroldies.net/index2.php?year='.$year.'&nid='.$number.'">';
> echo $vid[0];
> echo "</a>";
> echo "<br />";
> echo $vid[1];
> echo "<br />";
> echo $vid[3];
> echo" </div>\n";
Gosh, this is really unreadable code, I think you should make it more
readable , it's far easier to see HTML errors if you don't use that many
echo's.
tried:
$output = <<< EOF
<div class='bcol2'>
* {$nbumber} *<br />
<a
href='http://mroldies.net/index2.php?year={$year}&nid={$number}'>{$vid[0]}</a>
<br />
{$vid[1]}
<br />
{$vid[3]}
</div>
EOF;
sure your notepad++ would become a lot happier too.
To make a good code, you separate PHP functions and HTML generation as
much as possible, you don't need to echo, just end the PHP parsing with
a endtag and start it again with a starttag when you need, that is less
stressing for the system than using echo.
--
//Aho
|
|
|