FreePgs.com Forum

FreePgs Related => Support Requests => Topic started by: Paris on March 30, 2006, 01:55:33 AM

Title: how to show source code in an html document???
Post by: Paris on March 30, 2006, 01:55:33 AM
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>TEXT HERE</code>and also <pre>TEXT HERE</pre> but neither work like i want them to.

Please help soon, thanx.
Title: Re: how to show source code in an html document???
Post by: dest on March 30, 2006, 03:11:46 AM
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.
Title: Re: how to show source code in an html document???
Post by: GP™ on March 30, 2006, 03:34:04 AM
Also, If your using a automated service such as a forum (PHP ONLY) you can use this:
//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)


Title: Re: how to show source code in an html document???
Post by: Paris on March 30, 2006, 05:24:04 AM
thanks alot!!! ;D
Title: Re: how to show source code in an html document???
Post by: zz4 on April 02, 2006, 07:59:44 AM
Not sure desire...



To make simple html visible on a web page   <xmp></xmp>   ???
Title: Re: how to show source code in an html document???
Post by: webzone (archived) on April 02, 2006, 09:23:20 AM
QuoteTo make simple html visible on a web page   <xmp></xmp>

xmp is a deprecated tag and should not be used anymore.
Title: Re: how to show source code in an html document???
Post by: zz4 on April 02, 2006, 10: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?
Title: Re: how to show source code in an html document???
Post by: webzone (archived) on April 02, 2006, 11:23:38 PM
QuoteWas not <br> going obsolete?

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

QuoteBad 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.

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

W3Schools (http://www.w3schools.com/tags/) has a list of HTML tags and shows which ones are deprecated.
Title: Re: how to show source code in an html document???
Post by: zz4 on April 03, 2006, 04:02:01 AM
gezzzz   I'm still using things like <center>  <font....



I guess bad practice but if the latest browsers support them......---===
Title: Re: how to show source code in an html document???
Post by: LegendPro on April 06, 2006, 07: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
Title: Re: how to show source code in an html document???
Post by: webzone (archived) on April 06, 2006, 09:51:44 PM
QuoteThe 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) (http://hixie.ch/advocacy/xhtml) 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.
Title: Re: how to show source code in an html document???
Post by: sixthcrusifix on April 07, 2006, 11: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.