How to print "html" tag ( including '<' and '>' also) tag using html without using text areas and javascipt also
A:
What you can easily do is grab the contents of a page (etc) and then escape the HTML its entities.
Say this little two lines of php will get example.com code and print it out as HTML.
<pre>
<?php
$file = file_get_contents('http://www.example.com');
echo htmlentities($file);
?>
</pre>
htmlentities - Convert all applicable characters to HTML entities
Frankie
2010-08-17 17:29:07
This isn't related to the question.
xintron
2010-08-17 18:12:37
@xintron: Jagan asked how to do it without using text-areas or javascript. My answer explains what are HTML character entity references and also gives a little code snippet so the user understands there are already functions in place than can do this for him.
Frankie
2010-08-17 18:21:06
@Frankie: Your answer requires a computer with PHP available. Your answer explains briefly how to convert a string with HTML-characters to HTML entities. This wasn't what Jagan asked for. He/She wanted a simple answer explaining about HTML-entities and how to use them to produce what he/she needs. A list with common HTML-entities might have been more appropriate (ie. http://www.w3schools.com/tags/ref_entities.asp )
xintron
2010-08-17 18:50:32
+2
A:
Special characters in HTML, such as '<', '>', '"' and '&' can be printed using the following format:
&name;
where name would be replaced by a character name. The most common would then be
< = < (less than)
> = > (greater than)
& = & (ampersand)
" = " (double quote)
So to write <html> you would write in HTML:
<html>
Frxstrem
2010-08-17 18:02:42