JazzcatCB
12-12-2005, 08:42 PM
Can anyone tell me how to display HTML code inside a div without it getting translated by the browser? I tried the <code> tag, but it didn't work. Any ideas? Thanks.
|
Click to See Complete Forum and Search --> : Displaying HTML in a div without getting translated? JazzcatCB 12-12-2005, 08:42 PM Can anyone tell me how to display HTML code inside a div without it getting translated by the browser? I tried the <code> tag, but it didn't work. Any ideas? Thanks. phpmyborder 12-12-2005, 08:49 PM <pre> </pre> and <code> </code> can be used, but you need to mask the < > signs with < and > or you can use php htmlspecialchars() if that is available... JazzcatCB 12-13-2005, 02:29 AM <pre> </pre> and <code> </code> can be used, but you need to mask the < > signs with < and > or you can use php htmlspecialchars() if that is available... Thanks for the suggestion to use htmlspecialchars(). That's just what I needed. I am encountering one problem though: I put '\n' chars in my string, and either stripslashes() or htmlspecialchars() seems to be removing them. Do you know how I can prevent this from happening? Thanks a lot. felgall 12-13-2005, 02:31 PM Use nl2br() first. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |