xmp, what to use instead of.

M

myphplists

We use <xmp>, a quieter version of <pre>, a lot. However, it's
deprecated. It works great in FF and that's kinda all we care about,
BUT, we want to play ball. What is used instead <xmp> now?
 
J

Jonathan N. Little

We use <xmp>, a quieter version of <pre>, a lot. However, it's
deprecated. It works great in FF and that's kinda all we care about,
BUT, we want to play ball. What is used instead <xmp> now?

What do you mean by *quieter*? Just use PRE, XMP and been deprecated
forever, or nearly so...
 
J

Jukka K. Korpela

2013-04-19 5:32 said:
We use <xmp>, a quieter version of <pre>, a lot. However, it's
deprecated. It works great in FF and that's kinda all we care about,
BUT, we want to play ball. What is used instead <xmp> now?

The very first HTML specification, HTML 2.0, said:

"Since CDATA declared content has a number of unfortunate interactions
with processing techniques and tends to be used and implemented
inconsistently, HTML documents should not contain XMP nor LISTING
elements -- the PRE tag is more expressive and more consistently supported."

http://www.w3.org/MarkUp/html-spec/html-spec_5.html#SEC5.5.2.1

The world around has changed in 17 years, but the HTML5 CR still plays
the same game, though it is more explicit:

"xmp

Use pre and code instead, and escape "<" and "&" characters as
"&lt;" and "&amp;" respectively."

http://www.w3.org/TR/html5/obsolete.html#non-conforming-features

In reality, <pre> is not "more expressive" except in the sense that
markup and entities are recognized inside it, which is normally
something people do *not* want when considering the use of <xmp> (unless
they want some color coding). There is no evidence of more consistent
support.

HTML5 spells out the situation, but the reference to <code> should have
the condition "if you would be using <xmp> to present computer code, as
people mostly do".

<xmp> has been frowned upon because at some point, some people, trying
to retrofit the improvised tag soup system called "HTML" into SGML,
started thinking that CDATA declared content wasn't really in the spirit
of SGML. Later, nobody has really defended <xmp> against all the false
accusations or the discrimination based just on its being different.

<xmp> does its job well. It is true that it is anomalous, truly unique
in its nature (if we ignore <plaintext>, which was a real oddity): it is
the only element inside which no markup, not even character and entity
references, is recognized, except for the end tag of the element itself.
And this is exactly why it was invented and why it is used: to present
text without having any markup recognized but treated as plain text.

If you are generating HTML programmatically, it is a peace of cake to
escape "<" and "&". Doing that by hand tends to be error-prone, and the
only reason to bother is that some people may peek into your code and
declare <xmp>, and you, deprecated, obsolete, forbidden, cursed,
anathema, etc. That's often a very real risk - and it makes people look
for <table> as well, or anything that is "not semantic" in their book.
 
J

Jan Clemens Faerber

We use <xmp>, a quieter version of <pre>, a lot. However, it's

deprecated. It works great in FF and that's kinda all we care about,

BUT, we want to play ball. What is used instead <xmp> now?

I didn't test it now but I heard last week in my php course that you shouldbe very careful when you use a <textarea> in your code because php will take any white space as it is and then you see the curser not in the very beginnen of the box but somewhere in the middle.

maybe you can start a game with it
 
J

Jukka K. Korpela

2013-04-28 19:06 said:
I didn't test it now but I heard last week in my php course that you
should be very careful when you use a <textarea>

in your code because
php will take any white space as it is

PHP does not do any such thing. Browsers that get HTML documents
containing <textarea> elements do so, by definition.
 
J

Jan Clemens Faerber

2013-04-28 19:06, Jan Clemens Faerber wrote:
Nobody mentioned or even alluded to <textarea> before this. So what is
your point?

the point is that the result of some text between an opening and closing textarea-tag which you echo out with php into a final html file will be shownin a similar way like some text in a simple html file without using php.

PHP does not do any such thing. Browsers that get HTML documents
containing <textarea> elements do so, by definition.

what I heard is that if you have some code to echo out within some lines ofphp code like document.writeln in JS the php will watch out for the whitespaces inbetween opening and ending <textarea> tags - and it will result in an output like a value attribute of <textarea>.

So you will have <textarea value="www"> and "www" will contain all the whitespaces you simply filled into the line(s) until you reach the closing </textarea> tag. And so you may find some php generated forms where you jump from one <input> to the next <> active element and when you reach the textarea the curser in that box won't be in the beginning - because of the prefilled whitespaces -

I haven't noticed that yet - I just repeat what someone told me to be awareof.
 
J

Jukka K. Korpela

2013-04-29 2:15 said:
The top poster wanted to know something about other things beside the depricated <xmp> tag - so...?

So you thought you think you should tell all you thought you know about
HTML tags?
I just repeat what someone told me to be aware of.

.... or all you heard about them?
 
J

Jan Clemens Faerber

2013-04-29 2:15, Jan Clemens Faerber wrote:

So you thought you think you should tell all you thought you know about
HTML tags?

sometimes it's much easier to draw on a piece of paper.
... or all you heard about them?

"tag" is a wide definition.
you can tag your pictures or look at those price tags in this group:

Here you find one article "Jukka K. Korpela professional answer à U$ 0.00"

I hope you got your thrill now and can shave your beard.
 
J

Jonathan N. Little

Jan said:
sometimes it's much easier to draw on a piece of paper.



"tag" is a wide definition.
you can tag your pictures or look at those price tags in this group:

Here you find one article "Jukka K. Korpela professional answer à U$ 0.00"

I hope you got your thrill now and can shave your beard.

The problem here is that you offered information unrelated to the OP's
original question which was about a long ago deprecated element and its
possible replacement AND what you did report was totally incorrect. A
textarea does not have a value attribute but uses the content between
the opening and closing tags for its initial value.

<http://www.w3.org/TR/html401/interact/forms.html#initial-value>

PHP does not have anything to do with whitespace in a form control. If
you have whitespace between tags in a textarea it will be its initial
value same as <input name="textbox" type="text" value=" ">. It's HTML
not PHP.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top