Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #10772 > unrolled thread
| Started by | richard <noreply@example.com> |
|---|---|
| First post | 2013-09-16 09:20 -0400 |
| Last post | 2013-09-16 20:40 +0200 |
| Articles | 17 — 8 participants |
Back to article view | Back to comp.lang.php
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
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-09-16 09:20 -0400 |
| Subject | syntax error or notepad++ error? |
| Message-ID | <zufc0c2efad9.1rt9lmbdi53xw$.dlg@40tude.net> |
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"; $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.
[toc] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-09-16 14:10 +0000 |
| Message-ID | <l173ga$mst$2@dont-email.me> |
| In reply to | #10772 |
On Mon, 16 Sep 2013 09:20:03 -0400, richard wrote: > So where's the syntax issue at? Possibly in the code you haven't shown us. > I made sure all tags matched properly before including the code. Is this div contained within an inline element? eg a span? Is notepad just confused? -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-09-16 14:11 +0000 |
| Message-ID | <l173i6$mst$3@dont-email.me> |
| In reply to | #10772 |
On Mon, 16 Sep 2013 09:20:03 -0400, richard wrote: > So where's the syntax issue at? What happens when you feed the resulting output into the validator? -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Paul Herber <paul@pherber.com> |
|---|---|
| Date | 2013-09-16 15:12 +0100 |
| Message-ID | <hd4e399mq6r3cilf1mnqkbl09o2c0filkd@news.eternal-september.org> |
| In reply to | #10772 |
On Mon, 16 Sep 2013 09:20:03 -0400, richard <noreply@example.com> 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.'">'; You have single quotes in the URL that are closing the cho statement. -- Regards, Paul Herber, Sandrila Ltd. http://www.sandrila.co.uk/ twitter: @sandrilaLtd
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-09-16 10:50 -0400 |
| Message-ID | <co8ngsetomab$.1fu14ueb932bj$.dlg@40tude.net> |
| In reply to | #10777 |
On Mon, 16 Sep 2013 15:12:44 +0100, Paul Herber wrote: > On Mon, 16 Sep 2013 09:20:03 -0400, richard <noreply@example.com> 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.'">'; > > You have single quotes in the URL that are closing the cho statement. I removed the ? and everything after, it still won't pair up properly. I reversed the single and dounle quotes, no change. used the \" method, no change.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-09-16 11:05 -0400 |
| Message-ID | <l176nc$1is$1@dont-email.me> |
| In reply to | #10777 |
On 9/16/2013 10:12 AM, Paul Herber wrote: > On Mon, 16 Sep 2013 09:20:03 -0400, richard <noreply@example.com> 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.'">'; > > You have single quotes in the URL that are closing the cho statement. > > > Which is perfectly valid... -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Paul Herber <paul@pherber.com> |
|---|---|
| Date | 2013-09-16 17:52 +0100 |
| Message-ID | <cnde395t7r2adkcl02eh9iavv62299s9l8@news.eternal-september.org> |
| In reply to | #10779 |
On Mon, 16 Sep 2013 11:05:19 -0400, Jerry Stuckle <jstucklex@attglobal.net> wrote: >On 9/16/2013 10:12 AM, Paul Herber wrote: >> On Mon, 16 Sep 2013 09:20:03 -0400, richard <noreply@example.com> 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.'">'; >> >> You have single quotes in the URL that are closing the cho statement. >> >> >> > >Which is perfectly valid... Oops, my mistook, I didn't notice the . concatenating the strings! -- Regards, Paul Herber, Sandrila Ltd. http://www.sandrila.co.uk/ twitter: @sandrilaLtd
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-09-16 17:52 +0200 |
| Message-ID | <2833074.z7OigTIOpx@PointedEars.de> |
| In reply to | #10777 |
Paul Herber wrote:
> On Mon, 16 Sep 2013 09:20:03 -0400, richard <noreply@example.com> 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.'">';
^--^
>
> You have single quotes in the URL that are closing the cho statement.
Nonsense.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-09-16 11:12 -0400 |
| Message-ID | <l1774j$5mv$1@dont-email.me> |
| In reply to | #10772 |
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.'&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
==================
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-09-16 13:14 -0400 |
| Message-ID | <1xrmo7ivhwgsa.1gfjn2mzpfo6f.dlg@40tude.net> |
| In reply to | #10780 |
On Mon, 16 Sep 2013 11:12:22 -0400, Jerry Stuckle wrote: > 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.'&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). > Actually, notepad++ does accept all you listed except the < and > signs. > 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. I did and it did not find anyhting out of whack.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-09-16 13:47 -0400 |
| Message-ID | <l17g6q$u05$1@dont-email.me> |
| In reply to | #10785 |
On 9/16/2013 1:14 PM, richard wrote: > On Mon, 16 Sep 2013 11:12:22 -0400, Jerry Stuckle wrote: > >> 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.'&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). >> > > Actually, notepad++ does accept all you listed except the < and > signs. > Sure, it will *ACCEPT* it - but it will not *PROCESS* it properly. > >> 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. > > I did and it did not find anyhting out of whack. > Then your code is fine. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-09-16 11:13 -0400 |
| Message-ID | <16zkkw17691vt$.1hwf645tpfohv$.dlg@40tude.net> |
| In reply to | #10772 |
On Mon, 16 Sep 2013 09:20:03 -0400, 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"; > > $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. followup apparently, notepad++ doesn't like tags in echo. echo "<div>" is not ok. while echo "div" is. otherwise, the code by itself is kosher. so I guess I'm gonna have to use the & version for the tag brackets.
[toc] | [prev] | [next] | [standalone]
| From | Christoph Michael Becker <cmbecker69@arcor.de> |
|---|---|
| Date | 2013-09-16 17:35 +0200 |
| Message-ID | <52372537$0$6558$9b4e6d93@newsspool4.arcor-online.net> |
| In reply to | #10781 |
richard wrote:
> so I guess I'm gonna have to use the & version for the tag brackets.
You may consider using PHP's "template" syntax instead:
<div class="bcol2">
* <?php echo $number;?> *<br />
<a href="http://mroldies.net/index2.php?year='<?php echo
$year;?>&nid='<?php echo $number;?>">
<?php echo $vid[0];?>
</a>
<br />
<?php echo $vid[1];?>
<br />
<?php echo $vid[3];?>
</div>
--
Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-09-16 13:48 -0400 |
| Message-ID | <l17g8f$u05$2@dont-email.me> |
| In reply to | #10782 |
On 9/16/2013 11:35 AM, Christoph Michael Becker wrote: > richard wrote: > >> so I guess I'm gonna have to use the & version for the tag brackets. > > You may consider using PHP's "template" syntax instead: > > <div class="bcol2"> > * <?php echo $number;?> *<br /> > <a href="http://mroldies.net/index2.php?year='<?php echo > $year;?>&nid='<?php echo $number;?>"> > <?php echo $vid[0];?> > </a> > <br /> > <?php echo $vid[1];?> > <br /> > <?php echo $vid[3];?> > </div> > What a mess! -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Norman Peelman <npeelman@cfl.rr.com> |
|---|---|
| Date | 2013-09-16 21:49 -0400 |
| Message-ID | <l18cfl$r4l$1@dont-email.me> |
| In reply to | #10782 |
On 09/16/2013 11:35 AM, Christoph Michael Becker wrote: > richard wrote: > >> so I guess I'm gonna have to use the & version for the tag brackets. > > You may consider using PHP's "template" syntax instead: > > <div class="bcol2"> > * <?php echo $number;?> *<br /> > <a href="http://mroldies.net/index2.php?year='<?php echo > $year;?>&nid='<?php echo $number;?>"> > <?php echo $vid[0];?> > </a> > <br /> > <?php echo $vid[1];?> > <br /> > <?php echo $vid[3];?> > </div> > My eyes! My eyes! Please - someone stop the pain!!!! -- Norman Registered Linux user #461062 -Have you been to www.php.net yet?-
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-09-17 18:48 +0200 |
| Message-ID | <1499721.eQ1fCPtrnt@PointedEars.de> |
| In reply to | #10789 |
Norman Peelman wrote: > On 09/16/2013 11:35 AM, Christoph Michael Becker wrote: >> richard wrote: >>> so I guess I'm gonna have to use the & version for the tag brackets. >> >> You may consider using PHP's "template" syntax instead: >> >> <div class="bcol2"> >> * <?php echo $number;?> *<br /> >> <a href="http://mroldies.net/index2.php?year='<?php echo >> $year;?>&nid='<?php echo $number;?>"> >> <?php echo $vid[0];?> >> </a> >> <br /> >> <?php echo $vid[1];?> >> <br /> >> <?php echo $vid[3];?> >> </div> > > My eyes! My eyes! Please - someone stop the pain!!!! :) Are you referring to the tag soup? If yes, to be fair, Christoph just rewrote with “‘template’ syntax” what was in the OP. PointedEars -- When all you know is jQuery, every problem looks $(olvable).
[toc] | [prev] | [next] | [standalone]
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Date | 2013-09-16 20:40 +0200 |
| Message-ID | <b9p1kdFnpiU1@mid.individual.net> |
| In reply to | #10772 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web