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


Groups > comp.lang.php > #10780

Re: syntax error or notepad++ error?

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: syntax error or notepad++ error?
Date 2013-09-16 11:12 -0400
Organization A noiseless patient Spider
Message-ID <l1774j$5mv$1@dont-email.me> (permalink)
References <zufc0c2efad9.1rt9lmbdi53xw$.dlg@40tude.net>

Show all headers | View raw


On 9/16/2013 9:20 AM, 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";
>
> $number++;
>
> Notepad++ matches the opening division with the very last closing division
> tag.
> Not the closing tag it is supposed to pair with.
> Without this code, the pairs match.
>
> So where's the syntax issue at?
>
> I made sure all tags matched properly before including the code.
>

There's a limit as to how much editors can interpret the code.  For 
instance, they can't properly parse something like:

<?php if ($i == 3)
    echo "<div class='foo'\n";
?>

because $i is only meaningful during the execution of the page.

They also don't handle things like:

echo "<";
echo "div ";
echo "class='foo'";
echo ">\n";

Even though this generates perfectly valid HTML (I know you wouldn't 
write it like this, but it's an example).

As a result, when you mix things like regular html and html generated by 
php (or any other language), editors are bound to get confused at some 
point in time.  It's just a limit of what editors can do.

The best way is to run the generated page through the HTML validator, as 
Denis suggested.


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next 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