Page 1 of 1

HTML Tag to Characters Conversion

Posted: Sat Mar 13, 2010 3:22 pm
by devarishi
Hi,

In my web page there is a variable that contains HTML Tags as shown here:

Code: Select all

$msgBody = "<pre>Media ID\t\tLibrary Name</pre>"; 
$msgBody .= "<pre>--------------------------</pre>"; 
[b]---TRUNCATED---[/b]
The value of the variable is being written to a Text File and the output (the contents of the text file) also shows up the HTML Tags:

Code: Select all

 
<pre>Media ID       Library Name</pre><pre>--------------------------</pre><pre>123456          Goose</pre><pre>789651          Goose</pre>
So, how to convert HTML Tags before writing the variable's value to the text file? I think there is a function in PHP that serves this purpose.

Any ideas?




Note: http://corz.org/machine/source/php/tag-tools.php

Check out: Strip HTML Tags... button it does the work.

Re: HTML Tag to Characters Conversion

Posted: Sat Mar 13, 2010 4:55 pm
by devarishi

Re: HTML Tag to Characters Conversion

Posted: Sat Mar 13, 2010 5:02 pm
by McInfo
Why are there multiple sets of <pre> tags? Why not use "\n"?

Can you create the string without tags, write it to the file, then add the tags?

Edit: This post was recovered from search engine cache.