asmith Posted January 15, 2008 Share Posted January 15, 2008 how can i make some part of my code plain text ? i mean how can i show html code ? for example i want to show " <br />" on page . not the thing this code do . just the characters . not with > or something , assume i have a large code of html . i can't do it for all . any specific tag for it ? Quote Link to comment https://forums.phpfreaks.com/topic/86079-solved-html-code-to-plain-text/ Share on other sites More sharing options...
sKunKbad Posted January 15, 2008 Share Posted January 15, 2008 use pre tags Quote Link to comment https://forums.phpfreaks.com/topic/86079-solved-html-code-to-plain-text/#findComment-439590 Share on other sites More sharing options...
asmith Posted January 15, 2008 Author Share Posted January 15, 2008 nah , pre do not do such thing ! just test it : <pre><b>hello</b><br /><i>hi!</i></pre> it won't show me the html code . Quote Link to comment https://forums.phpfreaks.com/topic/86079-solved-html-code-to-plain-text/#findComment-439629 Share on other sites More sharing options...
atl_andy Posted January 15, 2008 Share Posted January 15, 2008 I think you need to escape what you want to show. Use \" to show a " in your text, or \\ to show a \ in your text. Quote Link to comment https://forums.phpfreaks.com/topic/86079-solved-html-code-to-plain-text/#findComment-439942 Share on other sites More sharing options...
effigy Posted January 15, 2008 Share Posted January 15, 2008 If you want to show HTML markup within an HTML page, you have to use entities. See htmlspecialchars. Quote Link to comment https://forums.phpfreaks.com/topic/86079-solved-html-code-to-plain-text/#findComment-439944 Share on other sites More sharing options...
tinker Posted January 15, 2008 Share Posted January 15, 2008 as effigy say's look at htmlspecialchars and run a whole alphameric set through it to see what's different. When I do tutorials I only really need to use < and > which are the one's which get in the way most. Oh yes, there < and > Quote Link to comment https://forums.phpfreaks.com/topic/86079-solved-html-code-to-plain-text/#findComment-439989 Share on other sites More sharing options...
monkeytooth Posted January 15, 2008 Share Posted January 15, 2008 are you even using PHP? anyway... something like this maybe... & - &<br> < - <<br> > - > Quote Link to comment https://forums.phpfreaks.com/topic/86079-solved-html-code-to-plain-text/#findComment-440242 Share on other sites More sharing options...
asmith Posted January 16, 2008 Author Share Posted January 16, 2008 thanks, that function was what i needed ! really thanks! Quote Link to comment https://forums.phpfreaks.com/topic/86079-solved-html-code-to-plain-text/#findComment-440659 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.