FreePgs.com Forum
September 22, 2021, 05:34:20 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Click Here for Toll-Free Service for your business starting at $2.00 per month and 4.5 cents per minute
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: how to show source code in an html document???  (Read 7517 times)
Paris
IE Go Away......Get FF!!!
Non-Verified Account
Jr. Member
**

Karma: +0/-0
Offline Offline

Posts: 30


Blog entries (0)

View Profile WWW
« on: March 29, 2006, 08:55:33 PM »

Can someone please tell me if there is a certain attribute i can use to show code snippets or large sections of code on my site? Like on forums you can use [ c o d e ] [ / c o d e] to show code. I tried using
Code:
<code>TEXT HERE</code>
and also
Code:
<pre>TEXT HERE</pre>
but neither work like i want them to.

Please help soon, thanx.
Logged

dest
1337 hax0r
Verified Account
Full Member
*

Karma: +0/-0
Offline Offline

Posts: 130


Yar

Blog entries (0)

View Profile
« Reply #1 on: March 29, 2006, 10:11:46 PM »

paste your code that you want displayed into notepad. Use replace to change the following

< to &lt;
> to &gt;

Put the code on the page where you want it, and it will not be read as html.
Logged

meh Tongue
FreePgs.com Forum
« Reply #1 on: March 29, 2006, 10:11:46 PM »

 Logged
GP™
Technical Support
Hero Member
*****

Karma: +16/-0
Offline Offline

Posts: 874


Wondermous

Blog entries (0)

View Profile WWW
« Reply #2 on: March 29, 2006, 10:34:04 PM »

Also, If your using a automated service such as a forum (PHP ONLY) you can use this:
Code:
//Pulls Message From Textarea On Submit
$message = $_POST['message'];

// Replaces < With &lt;
$message = str_replace("<", "&lt;", $message);

// Replaces > With &gt;
$message = str_replace(">", "&gt;", $message)

Logged
Paris
IE Go Away......Get FF!!!
Non-Verified Account
Jr. Member
**

Karma: +0/-0
Offline Offline

Posts: 30


Blog entries (0)

View Profile WWW
« Reply #3 on: March 30, 2006, 12:24:04 AM »

thanks alot!!! Grin
Logged

FreePgs.com Forum
« Reply #3 on: March 30, 2006, 12:24:04 AM »

 Logged
zz4
Non-Verified Account
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 15

Blog entries (0)

View Profile
« Reply #4 on: April 02, 2006, 03:59:44 AM »

Not sure desire...



To make simple html visible on a web page   <xmp></xmp>   Huh
Logged
webzone (archived)
Official Technical Support
Verified Account
Hero Member
*

Karma: +0/-0
Offline Offline

Posts: 508

Archived Account

Blog entries (0)

View Profile
« Reply #5 on: April 02, 2006, 05:23:20 AM »

Quote
To make simple html visible on a web page   <xmp></xmp>

xmp is a deprecated tag and should not be used anymore.
Logged
zz4
Non-Verified Account
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 15

Blog entries (0)

View Profile
« Reply #6 on: April 02, 2006, 06:41:56 PM »

Bad Thinking but if browsers still digest it?



I have not tried XMP in a long time.


Where's there a list of no-no stuff? (for education)


Was not <br> going obsolete?
Logged
webzone (archived)
Official Technical Support
Verified Account
Hero Member
*

Karma: +0/-0
Offline Offline

Posts: 508

Archived Account

Blog entries (0)

View Profile
« Reply #7 on: April 02, 2006, 07:23:38 PM »

Quote
Was not <br> going obsolete?

I don't remember anything about <br> becoming obsolete.

Quote
Bad Thinking but if browsers still digest it?

I have not tried XMP in a long time.

Browsers are not obliged to support it anymore. Some may still accept it if they want to.

Quote
Where's there a list of no-no stuff? (for education)

W3Schools has a list of HTML tags and shows which ones are deprecated.
Logged
zz4
Non-Verified Account
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 15

Blog entries (0)

View Profile
« Reply #8 on: April 03, 2006, 12:02:01 AM »

gezzzz   I'm still using things like <center>  <font....



I guess bad practice but if the latest browsers support them......---===
Logged
LegendPro
Technical Support
Newbie
*****

Karma: +0/-0
Offline Offline

Posts: 23

Blog entries (0)

View Profile WWW
« Reply #9 on: April 06, 2006, 03:38:09 PM »

The best way to go nowadays in coding HTML is using XHTML.  Basically its just a cleaner and stricter version of HTML.  You can learn about XHTML here... http://www.w3schools.com/xhtml/default.asp
Logged

webzone (archived)
Official Technical Support
Verified Account
Hero Member
*

Karma: +0/-0
Offline Offline

Posts: 508

Archived Account

Blog entries (0)

View Profile
« Reply #10 on: April 06, 2006, 05:51:44 PM »

Quote
The best way to go nowadays in coding HTML is using XHTML.

It is important to be careful when using XHTML. This document (Sending XHTML as text/html Considered Harmful) explains the problems it can cause.

One of the major problems blocking the use of real XHTML is that Internet Explorer still doesn't support it and IE 7 won't either. To be processed as XHTML, a page must be sent with the application/xhtml+xml MIME type and IE doesn't accept that.
Logged
sixthcrusifix
Sage
Verified Account
Sr. Member
*

Karma: +0/-3
Offline Offline

Posts: 445


http://sixthcrusifix.com/home/

Blog entries (0)

View Profile WWW
« Reply #11 on: April 07, 2006, 07:16:55 AM »

Why don't you just put it in a textarea? Then you even have a scrolly box.

<textarea cols='50' rows='6'>
TEXT HERE
</textarea>

cols = colums, how wide it is (usualy a LOT more than rows)
Rows = rows, how tall it is.
Logged

Visite me website at http://www.sixthcrusifix.com
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!