Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #3262 > unrolled thread
| Started by | Linus Flustillbe <admin@nacs.dyndns-office.com> |
|---|---|
| First post | 2011-10-02 14:00 +0000 |
| Last post | 2011-10-04 09:38 -0400 |
| Articles | 20 on this page of 28 — 13 participants |
Back to article view | Back to comp.lang.php
Question about new lines Linus Flustillbe <admin@nacs.dyndns-office.com> - 2011-10-02 14:00 +0000
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-02 14:17 +0000
Re: Question about new lines Linus Flustillbe <admin@nacs.dyndns-office.com> - 2011-10-02 16:36 +0000
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-02 21:58 +0000
Re: Question about new lines The Natural Philosopher <tnp@invalid.invalid> - 2011-10-03 05:35 +0100
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-03 07:53 +0000
Re: Question about new lines Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-03 11:40 +0200
Re: Question about new lines Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-03 07:26 -0400
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-03 11:42 +0000
Re: Question about new lines Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-03 08:48 -0400
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-03 13:05 +0000
Re: Question about new lines Robert Heller <heller@deepsoft.com> - 2011-10-03 08:49 -0500
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-03 14:11 +0000
Re: Question about new lines Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-03 10:57 -0400
Re: Question about new lines "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> - 2011-10-03 15:14 +0000
Re: Question about new lines Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-03 14:57 -0400
Re: Question about new lines Mason Barge <masonbarge@gmail.com> - 2011-10-05 15:20 -0400
Re: Question about new lines Tim Streater <timstreater@greenbee.net> - 2011-10-06 12:27 +0100
Re: Question about new lines Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-03 10:54 -0400
Re: Question about new lines Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-03 14:51 +0200
Re: Question about new lines Tim Streater <timstreater@greenbee.net> - 2011-10-06 12:21 +0100
Re: Question about new lines The Natural Philosopher <tnp@invalid.invalid> - 2011-10-02 16:21 +0100
Re: Question about new lines Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-02 11:43 -0400
Re: Question about new lines Denis McMahon <denismfmcmahon@gmail.com> - 2011-10-02 19:08 +0000
Re: Question about new lines "Peter H. Coffin" <hellsop@ninehells.com> - 2011-10-02 19:57 -0500
Re: Question about new lines Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2011-10-02 23:52 +0200
Re: Question about new lines Gordon Burditt <gordon@hammy.burditt.org> - 2011-10-03 00:15 -0500
Re: Question about new lines Michael Joel <no@please.com> - 2011-10-04 09:38 -0400
Page 1 of 2 [1] 2 Next page →
| From | Linus Flustillbe <admin@nacs.dyndns-office.com> |
|---|---|
| Date | 2011-10-02 14:00 +0000 |
| Subject | Question about new lines |
| Message-ID | <4e886e7b$0$5356$9a566e8b@news.aliant.net> |
I come from a scripting background so am not unfamiliar
with the concept of CR/LF characters. I am in the process
of learning PHP via the following tutorial
http://mobilitystudies.com/mob/images/stories/PHP_Tutorial_From_beginner_to_master.pdf
Currently I have "hello.php" with the following lines of code
-------------------------
<html>
<body>
<?php
$d=date("D");
if ($d=="Fri")
echo "Have a nice weekend!";
elseif ($d=="Sun")
echo "Have a nice Sunday!";
else echo "Have a nice day!";
echo "\nhello boss"."\t"."does this work".PHP_EOL;
echo "again";
?>
</body>
</html>
---------------------------------
When I load this in my browser I see the following
------------------------
Have a nice Sunday! hello boss does this work again
-------------------------
And if I look at the page source (using Firefox)
--------------------------
<html>
<body>
Have a nice Sunday!
hello boss does this work
again</body>
</html>
------------------------
Should the "\n" not push a NewLine out to the output?
I did some research and found that the PHP_EOL seems to be what is
recommended since it is platform independant. But it doesn't work
either.
Can anyone suggest or point out what I am doing wrong, or is this a flaw
in php?
Thanks
--
********************************************************************************
* Usenet Impovement Project http://nacs.dyndns-office.com/usenet
* Bakers trade bread recipes on a knead-to-know basis.
*********************************************************************************
[toc] | [next] | [standalone]
| From | "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> |
|---|---|
| Date | 2011-10-02 14:17 +0000 |
| Message-ID | <xn0hjvspsntovmh01r@news.individual.net> |
| In reply to | #3262 |
On 02/10/2011 in message <4e886e7b$0$5356$9a566e8b@news.aliant.net> Linus Flustillbe wrote: >Should the "\n" not push a NewLine out to the output? >I did some research and found that the PHP_EOL seems to be what is >recommended since it is platform independant. But it doesn't work >either. I would use: echo "<br />"; Which will force a line break in HTML. -- Jeff Gaines Wiltshire UK I take full responsibility for what happened - that is why the person that was responsible went immediately. (Gordon Brown, April 2009)
[toc] | [prev] | [next] | [standalone]
| From | Linus Flustillbe <admin@nacs.dyndns-office.com> |
|---|---|
| Date | 2011-10-02 16:36 +0000 |
| Message-ID | <4e889326$0$5371$9a566e8b@news.aliant.net> |
| In reply to | #3263 |
On 2011-10-02, Jeff Gaines <jgaines_newsid@yahoo.co.uk> wrote: > On 02/10/2011 in message <4e886e7b$0$5356$9a566e8b@news.aliant.net> Linus > Flustillbe wrote: > >>Should the "\n" not push a NewLine out to the output? >>I did some research and found that the PHP_EOL seems to be what is >>recommended since it is platform independant. But it doesn't work >>either. > > I would use: > > echo "<br />"; > > Which will force a line break in HTML. > or we could use a <p> to force a paragraph switch. Thanks all for your help, I have it working now. -- ******************************************************************************** * Usenet Impovement Project http://nacs.dyndns-office.com/usenet * Bakers trade bread recipes on a knead-to-know basis. *********************************************************************************
[toc] | [prev] | [next] | [standalone]
| From | "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> |
|---|---|
| Date | 2011-10-02 21:58 +0000 |
| Message-ID | <xn0hjw4t3oa6h3401s@news.individual.net> |
| In reply to | #3267 |
On 02/10/2011 in message <4e889326$0$5371$9a566e8b@news.aliant.net> Linus Flustillbe wrote: >or we could use a <p> to force a paragraph switch. >Thanks all for your help, I have it working now. Don't forget you should close a <p> tag with </p> -- Jeff Gaines Wiltshire UK All those who believe in psychokinesis raise my hand.
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2011-10-03 05:35 +0100 |
| Message-ID | <j6be24$k8h$4@news.albasani.net> |
| In reply to | #3271 |
Jeff Gaines wrote: > On 02/10/2011 in message <4e889326$0$5371$9a566e8b@news.aliant.net> > Linus Flustillbe wrote: > >> or we could use a <p> to force a paragraph switch. >> Thanks all for your help, I have it working now. > > Don't forget you should close a <p> tag with </p> > I have never seen that ever in any source
[toc] | [prev] | [next] | [standalone]
| From | "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> |
|---|---|
| Date | 2011-10-03 07:53 +0000 |
| Message-ID | <xn0hjwx4covevi801t@news.individual.net> |
| In reply to | #3274 |
On 03/10/2011 in message <j6be24$k8h$4@news.albasani.net> The Natural Philosopher wrote: >Jeff Gaines wrote: >>On 02/10/2011 in message <4e889326$0$5371$9a566e8b@news.aliant.net> Linus >>Flustillbe wrote: >> >>>or we could use a <p> to force a paragraph switch. >>>Thanks all for your help, I have it working now. >> >>Don't forget you should close a <p> tag with </p> >> >I have never seen that ever in any source Really? http://www.w3schools.com/tags/tag_p.asp That would be an advantage of using <br /> for the OP. -- Jeff Gaines Wiltshire UK Indecision is the key to flexibility
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2011-10-03 11:40 +0200 |
| Message-ID | <2992742.SPkdTlGXAF@PointedEars.de> |
| In reply to | #3278 |
Jeff Gaines wrote: > The Natural Philosopher wrote: >> Jeff Gaines wrote: >>> On 02/10/2011 in message <4e889326$0$5371$9a566e8b@news.aliant.net> >>> Linus Flustillbe wrote: >>>> or we could use a <p> to force a paragraph switch. >>>> Thanks all for your help, I have it working now. >>> Don't forget you should close a <p> tag with </p> >> I have never seen that ever in any source > > Really? > > http://www.w3schools.com/tags/tag_p.asp W3Schools can be safely and must be strongly recommended against for use as a reliable resource on Web development. When in doubt, consult the official Specifications: <http://www.w3.org/TR/html401/struct/text.html#edef-P> However, the P/p element does have an _end_ tag, and it is a good idea to use it so that the paragraph will be delimited *explicitly*. In XHTML, it is mandatory anyway, as XHTML is an application of XML and well-formedness requires either an end tag or SHORTTAG syntax (as below). > That would be an advantage of using <br /> for the OP. <br /> is XHTML SHORTTAG (not considering HTML SHORTTAG, which is widely disregarded by browsers); <br>, <bR>, <Br> or <BR> is HTML. PHP has the nl2br() function to make printing newlines as BR/br elements in (X)HTML easier. BR/br usually suffices for debugging purposes. However, semantics are important: If the intention is to make a paragraph, use the P/p element; if it is to make an unconditional *line break* *within* *a* *text* *paragraph*, use the BR/br element. PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-03 07:26 -0400 |
| Message-ID | <j6c64g$joe$2@dont-email.me> |
| In reply to | #3278 |
On 10/3/2011 3:53 AM, Jeff Gaines wrote: > On 03/10/2011 in message <j6be24$k8h$4@news.albasani.net> The Natural > Philosopher wrote: > >> Jeff Gaines wrote: >>> On 02/10/2011 in message <4e889326$0$5371$9a566e8b@news.aliant.net> >>> Linus Flustillbe wrote: >>> >>>> or we could use a <p> to force a paragraph switch. >>>> Thanks all for your help, I have it working now. >>> >>> Don't forget you should close a <p> tag with </p> >>> >> I have never seen that ever in any source > > Really? > > http://www.w3schools.com/tags/tag_p.asp > > That would be an advantage of using <br /> for the OP. > Which isn't valid on html - only xhtml or xml. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> |
|---|---|
| Date | 2011-10-03 11:42 +0000 |
| Message-ID | <xn0hjx364p3laq801u@news.individual.net> |
| In reply to | #3280 |
On 03/10/2011 in message <j6c64g$joe$2@dont-email.me> Jerry Stuckle wrote: >Which isn't valid on html - only xhtml or xml. There seems to be confusion about whether or not the / is optional. In reality, of course, all browsers honour it. -- Those are my principles – and if you don’t like them, well, I have others. (Groucho Marx)
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-03 08:48 -0400 |
| Message-ID | <j6cau7$hu5$1@dont-email.me> |
| In reply to | #3281 |
On 10/3/2011 7:42 AM, Jeff Gaines wrote: > On 03/10/2011 in message <j6c64g$joe$2@dont-email.me> Jerry Stuckle wrote: > >> Which isn't valid on html - only xhtml or xml. > > There seems to be confusion about whether or not the / is optional. In > reality, of course, all browsers honour it. > Whether browsers honor it or not is immaterial. It is directly against the HTML spec, and attempts to validate pages with such ops will fail. Just because browsers currently support it does not mean future browsers will support something that violates the spec. It's also very sloppy programming. You are much better off conforming to the spec so the browser doesn't have to guess at what you want. Additionally, <br> does not have the same effect as <p>...</p>. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> |
|---|---|
| Date | 2011-10-03 13:05 +0000 |
| Message-ID | <xn0hjx5ewp6jtwj01w@news.individual.net> |
| In reply to | #3283 |
On 03/10/2011 in message <j6cau7$hu5$1@dont-email.me> Jerry Stuckle wrote: >Whether browsers honor it or not is immaterial. It is directly against >the HTML spec, and attempts to validate pages with such ops will fail. >Just because browsers currently support it does not mean future browsers >will support something that violates the spec. It's also very sloppy >programming. I use it on all my web sites and they all validate 100%. -- Jeff Gaines Wiltshire UK If you ever find something you like buy a lifetime supply because they will stop making it
[toc] | [prev] | [next] | [standalone]
| From | Robert Heller <heller@deepsoft.com> |
|---|---|
| Date | 2011-10-03 08:49 -0500 |
| Message-ID | <PqednU2_ou72IBTTnZ2dnUVZ_tmdnZ2d@posted.localnet> |
| In reply to | #3287 |
At 3 Oct 2011 13:05:18 GMT "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> wrote:
>
> On 03/10/2011 in message <j6cau7$hu5$1@dont-email.me> Jerry Stuckle wrote:
>
> >Whether browsers honor it or not is immaterial. It is directly against
> >the HTML spec, and attempts to validate pages with such ops will fail.
> >Just because browsers currently support it does not mean future browsers
> >will support something that violates the spec. It's also very sloppy
> >programming.
>
> I use it on all my web sites and they all validate 100%.
They would with a DOCTYPE like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Note: 'XHTML' above...
*XHTML* requires the </p> tag and <br /> and would raise at least a
warning if </p> were missing or there were br's with out the / (<br>).
Plain HTML4 does not need the </p> and should not support the <br />
tags (whether browsers browsers honor it or not).
--
Robert Heller -- 978-544-6933 / heller@deepsoft.com
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments
[toc] | [prev] | [next] | [standalone]
| From | "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> |
|---|---|
| Date | 2011-10-03 14:11 +0000 |
| Message-ID | <xn0hjx75pp8xlpr01x@news.individual.net> |
| In reply to | #3288 |
On 03/10/2011 in message <PqednU2_ou72IBTTnZ2dnUVZ_tmdnZ2d@posted.localnet> Robert Heller wrote: >They would with a DOCTYPE like this: It's actually: <!DOCTYPE html> As I don't see any point in using anything other than HTML5 on new pages nowadays. The start page should be: http://validator.w3.org/check?uri=http%3A%2F%2Fwww.jgaines.me.uk%2Findex.php The "Album" page is a mess at the moment, but will have to wait a while to be sorted. -- Jeff Gaines Wiltshire UK If it's not broken, mess around with it until it is
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-03 10:57 -0400 |
| Message-ID | <j6cigo$4r5$3@dont-email.me> |
| In reply to | #3289 |
On 10/3/2011 10:11 AM, Jeff Gaines wrote:
> On 03/10/2011 in message
> <PqednU2_ou72IBTTnZ2dnUVZ_tmdnZ2d@posted.localnet> Robert Heller wrote:
>
>> They would with a DOCTYPE like this:
>
> It's actually:
> <!DOCTYPE html>
>
> As I don't see any point in using anything other than HTML5 on new pages
> nowadays.
>
> The start page should be:
> http://validator.w3.org/check?uri=http%3A%2F%2Fwww.jgaines.me.uk%2Findex.php
>
>
> The "Album" page is a mess at the moment, but will have to wait a while
> to be sorted.
>
Info Using experimental feature: HTML5 Conformance Checker.
The validator checked your document with an experimental feature:
HTML5 Conformance Checker. This feature has been made available for your
convenience, but be aware that it may be unreliable, or not perfectly up
to date with the latest development of some cutting-edge technologies.
If you find any issues with this feature, please report them. Thank you.
Plus your DOCTYPE does not list a DTD
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> |
|---|---|
| Date | 2011-10-03 15:14 +0000 |
| Message-ID | <xn0hjx8sl874p000@news.individual.net> |
| In reply to | #3291 |
On 03/10/2011 in message <j6cigo$4r5$3@dont-email.me> Jerry Stuckle wrote: >On 10/3/2011 10:11 AM, Jeff Gaines wrote: >>On 03/10/2011 in message >><PqednU2_ou72IBTTnZ2dnUVZ_tmdnZ2d@posted.localnet> Robert Heller wrote: >> >>>They would with a DOCTYPE like this: >> >>It's actually: >><!DOCTYPE html> >> >>As I don't see any point in using anything other than HTML5 on new pages >>nowadays. >> >>The start page should be: >>http://validator.w3.org/check?uri=http%3A%2F%2Fwww.jgaines.me.uk%2Findex.php >> >> >>The "Album" page is a mess at the moment, but will have to wait a while >>to be sorted. >> > > Info Using experimental feature: HTML5 Conformance Checker. > >The validator checked your document with an experimental feature: HTML5 >Conformance Checker. This feature has been made available for your >convenience, but be aware that it may be unreliable, or not perfectly up >to date with the latest development of some cutting-edge technologies. If >you find any issues with this feature, please report them. Thank you. > It's the best available at the moment. >Plus your DOCTYPE does not list a DTD Not needed, it's HTML5. -- Jeff Gaines Wiltshire UK The facts, although interesting, are irrelevant
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-03 14:57 -0400 |
| Message-ID | <j6d0j7$csg$1@dont-email.me> |
| In reply to | #3292 |
On 10/3/2011 11:14 AM, Jeff Gaines wrote: > On 03/10/2011 in message <j6cigo$4r5$3@dont-email.me> Jerry Stuckle wrote: > >> On 10/3/2011 10:11 AM, Jeff Gaines wrote: >>> On 03/10/2011 in message >>> <PqednU2_ou72IBTTnZ2dnUVZ_tmdnZ2d@posted.localnet> Robert Heller wrote: >>> >>>> They would with a DOCTYPE like this: >>> >>> It's actually: >>> <!DOCTYPE html> >>> >>> As I don't see any point in using anything other than HTML5 on new pages >>> nowadays. >>> >>> The start page should be: >>> http://validator.w3.org/check?uri=http%3A%2F%2Fwww.jgaines.me.uk%2Findex.php >>> >>> >>> >>> The "Album" page is a mess at the moment, but will have to wait a while >>> to be sorted. >>> >> >> Info Using experimental feature: HTML5 Conformance Checker. >> >> The validator checked your document with an experimental feature: >> HTML5 Conformance Checker. This feature has been made available for >> your convenience, but be aware that it may be unreliable, or not >> perfectly up to date with the latest development of some cutting-edge >> technologies. If you find any issues with this feature, please report >> them. Thank you. >> > > It's the best available at the moment. > Which doesn't mean it is correct. >> Plus your DOCTYPE does not list a DTD > > Not needed, it's HTML5. > Ah, yes. The "floating standard". I'll start using it when they stop changing the standards (and browsers have better support for it). -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Mason Barge <masonbarge@gmail.com> |
|---|---|
| Date | 2011-10-05 15:20 -0400 |
| Message-ID | <6cbp87121hu80g1mr7cllh4a8a66up2kb1@4ax.com> |
| In reply to | #3289 |
On 3 Oct 2011 14:11:59 GMT, "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> wrote: >On 03/10/2011 in message ><PqednU2_ou72IBTTnZ2dnUVZ_tmdnZ2d@posted.localnet> Robert Heller wrote: > >>They would with a DOCTYPE like this: > >It's actually: ><!DOCTYPE html> > >As I don't see any point in using anything other than HTML5 on new pages >nowadays. I use HTML 5 too. It's really nice after all the XHTML, LOL. But question: Don't you need to use XHTML if you want to feed the page in XML via RSS? Or at least, isn't it convenient to be able to validate it so easily?
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2011-10-06 12:27 +0100 |
| Message-ID | <timstreater-C8AC38.12274006102011@news.individual.net> |
| In reply to | #3289 |
In article <xn0hjx75pp8xlpr01x@news.individual.net>, "Jeff Gaines" <jgaines_newsid@yahoo.co.uk> wrote: > On 03/10/2011 in message > <PqednU2_ou72IBTTnZ2dnUVZ_tmdnZ2d@posted.localnet> Robert Heller wrote: > > >They would with a DOCTYPE like this: > > It's actually: > <!DOCTYPE html> > > As I don't see any point in using anything other than HTML5 on new pages > nowadays. Indeed, xhtml is dead so don't bother with it any more. So, no more of this <br /> nonsense. -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-03 10:54 -0400 |
| Message-ID | <j6cibg$4r5$2@dont-email.me> |
| In reply to | #3287 |
On 10/3/2011 9:05 AM, Jeff Gaines wrote: > On 03/10/2011 in message <j6cau7$hu5$1@dont-email.me> Jerry Stuckle wrote: > >> Whether browsers honor it or not is immaterial. It is directly against >> the HTML spec, and attempts to validate pages with such ops will fail. >> Just because browsers currently support it does not mean future >> browsers will support something that violates the spec. It's also very >> sloppy programming. > > I use it on all my web sites and they all validate 100%. > What are you using for a doctype? Obviously not html. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2011-10-03 14:51 +0200 |
| Message-ID | <1766467.D2KPVSPYKU@PointedEars.de> |
| In reply to | #3281 |
Jeff Gaines wrote: > Jerry Stuckle wrote: >> Which isn't valid on html - only xhtml or xml. > > There seems to be confusion about whether or not the / is optional. Yes, that only *seems* to be so. > In reality, of course, all browsers honour it. Your logic is flawed. You simply cannot know about *all* browsers. AISB, *some* browsers, perhaps the majority in terms of market share, do not implement the SGML Declaration for HTML 4.01 [1] properly, which specifies the SHORTTAG syntax for HTML so that `<br />' is equivalent to `<br>>' in HTML (that allows, for example `<h1/My Title/' instead of `<h1>My Title</h1>') [2]. But the W3C Validator [3] does, which is why, e. g., <link … rel="…" … /> is _not_ a Valid HTML 4.01 fragment (as `>' would be character data which is not allowed within the `HEAD' element). This has led to the *current* HTML5 Working Draft regarding the trailing `/' between `<' and the corresponding `>' of a start tag as allowed and optional in the HTML syntax of HTML5 [4,5]. But you SHOULD NOT rely on that outside of HTML5, perhaps not even in HTML5 until it has become stable. HTH PointedEars ___________ [1] <http://www.w3.org/TR/html401/sgml/sgmldecl.html> [2] <http://www.w3.org/MarkUp/html3/HTMLandSGML.html> [3] <http://validator.w3.org/> [4] <http://www.w3.org/TR/2011/WD-html5-20110525/syntax.html#start-tags> [5] <http://www.w3.org/TR/2011/WD-html5-20110525/introduction.html#html-vs- xhtml> -- Anyone who slaps a 'this page is best viewed with Browser X' label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network. -- Tim Berners-Lee
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.php
csiph-web