Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Closed Thread
How to make HTML code appear as text
Old 08-15-2007, 01:11 PM How to make HTML code appear as text
Experienced Talker

Posts: 44
Name: English Hentai Team
Trades: 0
Greetings.

I want to put HTML text in my webpage, but I want it to appear as text. That is, the HTML isn't for me. It's for others to copy and paste it.

I want my visitors to be able to paste the Code without having to do anything else. They paste my text HTML, paste it in their pages and voilá, it's working

How can I make this, with only HTML: no Javascript nor PHP...

Thanks
__________________

Please login or register to view this content. Registration is FREE
ehentai is offline
View Public Profile
 
 
Register now for full access!
Old 08-15-2007, 01:12 PM Re: How to make HTML code appear as text
JamieLewis's Avatar
Pretty Much a Big Deal...

Latest Blog Post:
Gooie
Posts: 385
Name: Jamie Lewis
Location: UK
Trades: 0
You need to use entities &lt; for the '<' and &gt; for the '>' of the tags.

Jamie
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
JamieLewis is offline
View Public Profile Visit JamieLewis's homepage!
 
Old 08-15-2007, 01:14 PM Re: How to make HTML code appear as text
Novice Talker

Posts: 12
Trades: 0
Either do as Jamie suggested or you could add you code with in a input text field.
madk is offline
View Public Profile
 
Old 08-15-2007, 01:15 PM Re: How to make HTML code appear as text
JamieLewis's Avatar
Pretty Much a Big Deal...

Latest Blog Post:
Gooie
Posts: 385
Name: Jamie Lewis
Location: UK
Trades: 0
Quote:
Originally Posted by madk View Post
Either do as Jamie suggested or you could add you code with in a input text field.

But that would be an incorrect usage of the input text field.

Jamie
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
JamieLewis is offline
View Public Profile Visit JamieLewis's homepage!
 
Old 08-15-2007, 02:17 PM Re: How to make HTML code appear as text
Experienced Talker

Posts: 44
Name: English Hentai Team
Trades: 0
Quote:
Originally Posted by JamieLewis View Post
You need to use entities &lt; for the '<' and &gt; for the '>' of the tags.
...That makes sense
But gives a bit of work... Like if you use a text editor to replace everything, you'll have to make sure there are no "<" or ">" in the text :/
__________________

Please login or register to view this content. Registration is FREE

Last edited by ehentai; 08-15-2007 at 02:19 PM..
ehentai is offline
View Public Profile
 
Old 08-15-2007, 02:20 PM Re: How to make HTML code appear as text
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Why not use the <code> </code> tags - that's what it's for !
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
View Public Profile
 
Old 08-15-2007, 02:26 PM Re: How to make HTML code appear as text
Experienced Talker

Posts: 44
Name: English Hentai Team
Trades: 0
Quote:
Originally Posted by LadynRed View Post
Why not use the <code> </code> tags - that's what it's for !
Is that valid HTML? If so, that would simplify things very much
__________________

Please login or register to view this content. Registration is FREE
ehentai is offline
View Public Profile
 
Old 08-15-2007, 02:31 PM Re: How to make HTML code appear as text
Novice Talker

Latest Blog Post:
Lubbock Little League
Posts: 9
Name: Michele
Location: Beautiful Western North Carolina
Trades: 0
The code tag may have been intended for that, but the only thing it does is to change the font-face to monospaced. You still will have to use &gt; and &lt;.

That said, I use the code tag and style it with a bit of padding to indent it and with a different background color than the main text.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
itscribe is offline
View Public Profile Visit itscribe's homepage!
 
Old 08-15-2007, 03:03 PM Re: How to make HTML code appear as text
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Or, if you use a php enabled server and that your page is in PHP, you can add this at the top of your file, to force the browser to render the whole file as text:
PHP Code:
header('content-type: text/plain'); 
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
View Public Profile Visit tripy's homepage!
 
Old 08-15-2007, 04:00 PM Re: How to make HTML code appear as text
JamieLewis's Avatar
Pretty Much a Big Deal...

Latest Blog Post:
Gooie
Posts: 385
Name: Jamie Lewis
Location: UK
Trades: 0
Quote:
Originally Posted by LadynRed View Post
Why not use the <code> </code> tags - that's what it's for !

Because the code tag was designed for inline snippets and doesn't prevent html from being rendered. At the moment for block code snippets you should use a pre tag and use entities to preven any rendering inside them.

Jamie
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
JamieLewis is offline
View Public Profile Visit JamieLewis's homepage!
 
Old 08-15-2007, 06:50 PM Re: How to make HTML code appear as text
Experienced Talker

Posts: 44
Name: English Hentai Team
Trades: 0
Quote:
Originally Posted by JamieLewis View Post
At the moment for block code snippets you should use a pre tag and use entities to preven any rendering inside them.

Can you give an example. Like a piece of code of HTML where that's in action.
__________________

Please login or register to view this content. Registration is FREE
ehentai is offline
View Public Profile
 
Old 08-15-2007, 07:13 PM Re: How to make HTML code appear as text
JamieLewis's Avatar
Pretty Much a Big Deal...

Latest Blog Post:
Gooie
Posts: 385
Name: Jamie Lewis
Location: UK
Trades: 0
Yeha sure...

Code:
<pre>
&lt;html&gt;
....
&lt;/html&gt;
</pre>
That is the correct way to mark up, if you used a server side language you could automate the the entities.

Jamie
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
JamieLewis is offline
View Public Profile Visit JamieLewis's homepage!
 
Old 08-16-2007, 03:34 AM Re: How to make HTML code appear as text
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Given this as a proviso
Quote:
How can I make this, with only HTML: no Javascript nor PHP...
You will have to use hand coded HTML Entities

But to give you something to consider, here's a little something prepared earlier

http://www.webmaster-talk.com/html-f...play-code.html
post #12 & #14 for code
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 08-16-2007, 08:49 AM Re: How to make HTML code appear as text
Experienced Talker

Posts: 44
Name: English Hentai Team
Trades: 0
Quote:
Originally Posted by chrishirst View Post
Given this as a proviso

You will have to use hand coded HTML Entities

But to give you something to consider, here's a little something prepared earlier

http://www.webmaster-talk.com/html-f...play-code.html
post #12 & #14 for code
I'll probably just stick to HTML, my webpage is already to slow to add another script :/

But thanks.

BTW, it was written in the other thread that the tag <xmp> could work. Can anyone confirm this?
__________________

Please login or register to view this content. Registration is FREE
ehentai is offline
View Public Profile
 
Old 08-16-2007, 08:53 AM Re: How to make HTML code appear as text
JamieLewis's Avatar
Pretty Much a Big Deal...

Latest Blog Post:
Gooie
Posts: 385
Name: Jamie Lewis
Location: UK
Trades: 0
PLEASE do not use <xmp> it was depreciated years and years ago and was never a good tag to begin with. The only way to do this correctly is preparsing or by hand.

Jamie
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
JamieLewis is offline
View Public Profile Visit JamieLewis's homepage!
 
Old 08-16-2007, 08:56 AM Re: How to make HTML code appear as text
Experienced Talker

Posts: 44
Name: English Hentai Team
Trades: 0
I've just read that xmp is deprecated... Too bad because it worked... Don't know why there isn't already a tag like that one...
__________________

Please login or register to view this content. Registration is FREE
ehentai is offline
View Public Profile
 
Old 08-16-2007, 08:57 AM Re: How to make HTML code appear as text
JamieLewis's Avatar
Pretty Much a Big Deal...

Latest Blog Post:
Gooie
Posts: 385
Name: Jamie Lewis
Location: UK
Trades: 0
Quote:
Originally Posted by ehentai View Post
I've just read that xmp is deprecated... Too bad because it worked... Don't know why there isn't already a tag like that one...
Because it breaks several rules of valid markup. XML has CDATA formatting which can be used, but no such construct exists in SGML

Jamie
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
JamieLewis is offline
View Public Profile Visit JamieLewis's homepage!
 
Old 08-16-2007, 09:08 AM Re: How to make HTML code appear as text
Experienced Talker

Posts: 44
Name: English Hentai Team
Trades: 0
Well, it seems I 'll really have to replace those <, > and &. (with the Replace All command of course...)
Thanks for the help.
__________________

Please login or register to view this content. Registration is FREE
ehentai is offline
View Public Profile
 
Closed Thread     « Reply to How to make HTML code appear as text
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.55785 seconds with 12 queries