Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #10788

Re: syntax error or notepad++ error?

From "J.O. Aho" <user@example.net>
Newsgroups comp.lang.php
Subject Re: syntax error or notepad++ error?
Date 2013-09-16 20:40 +0200
Message-ID <b9p1kdFnpiU1@mid.individual.net> (permalink)
References <zufc0c2efad9.1rt9lmbdi53xw$.dlg@40tude.net>

Show all headers | View raw


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.'&amp;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}&amp;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


Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

syntax error or notepad++ error? richard <noreply@example.com> - 2013-09-16 09:20 -0400
  Re: syntax error or notepad++ error? Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-16 14:10 +0000
  Re: syntax error or notepad++ error? Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-16 14:11 +0000
  Re: syntax error or notepad++ error? Paul Herber <paul@pherber.com> - 2013-09-16 15:12 +0100
    Re: syntax error or notepad++ error? richard <noreply@example.com> - 2013-09-16 10:50 -0400
    Re: syntax error or notepad++ error? Jerry Stuckle <jstucklex@attglobal.net> - 2013-09-16 11:05 -0400
      Re: syntax error or notepad++ error? Paul Herber <paul@pherber.com> - 2013-09-16 17:52 +0100
    Re: syntax error or notepad++ error? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-09-16 17:52 +0200
  Re: syntax error or notepad++ error? Jerry Stuckle <jstucklex@attglobal.net> - 2013-09-16 11:12 -0400
    Re: syntax error or notepad++ error? richard <noreply@example.com> - 2013-09-16 13:14 -0400
      Re: syntax error or notepad++ error? Jerry Stuckle <jstucklex@attglobal.net> - 2013-09-16 13:47 -0400
  Re: syntax error or notepad++ error? richard <noreply@example.com> - 2013-09-16 11:13 -0400
    Re: syntax error or notepad++ error? Christoph Michael Becker <cmbecker69@arcor.de> - 2013-09-16 17:35 +0200
      Re: syntax error or notepad++ error? Jerry Stuckle <jstucklex@attglobal.net> - 2013-09-16 13:48 -0400
      Re: syntax error or notepad++ error? Norman Peelman <npeelman@cfl.rr.com> - 2013-09-16 21:49 -0400
        Re: syntax error or notepad++ error? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-09-17 18:48 +0200
  Re: syntax error or notepad++ error? "J.O. Aho" <user@example.net> - 2013-09-16 20:40 +0200

csiph-web