Ninjakreborn Posted August 11, 2006 Share Posted August 11, 2006 I need some very quick help. I need to just figure out how to make text show, no matter what language. It hink this is xhtml. I want to be able to display code in a browser, no matter what language, asp, jsp, html, php, javascript, whateverTO where when I write tutorials I can have code examples, and I want the code to print out to the screen without actually parsing, or running. Advice anybody?The reason I posted it in php, because I couldn't find anything relating to xhtml, that could do this, in php there is something called highlight so an entire page displays, but I don't know how to get code to display to the browser wherever I need for example code purposes. I also may need to do this with asp, javascript or whatever else, and if I can find one way to output whatever to the browser, and ignoring it as a language it would be helpful. Quote Link to comment https://forums.phpfreaks.com/topic/17283-quick-help/ Share on other sites More sharing options...
AndyB Posted August 11, 2006 Share Posted August 11, 2006 [code]<pre>whatever</pre>[/code]might helpOtherwise, convert < to & amp l t; and so on. Quote Link to comment https://forums.phpfreaks.com/topic/17283-quick-help/#findComment-73338 Share on other sites More sharing options...
Ninjakreborn Posted August 11, 2006 Author Share Posted August 11, 2006 It didn't work, it still runs the script. I mean like if I wanted to write a tutorial for javascript, ajax, php, sql, mysql, or something like asp, or even jsp, or xhtml, or something, I would want to be able to display the code.Like on php freaks if you put in code block it preserves the code for php, and xhtml language, without running it, like a way to show an example like[code]<?phpecho "Hello World!";?>[/code]instead of outputing hello world, it says the actual code, I need a way to do this with any language, but I can't figure out anything. Quote Link to comment https://forums.phpfreaks.com/topic/17283-quick-help/#findComment-73342 Share on other sites More sharing options...
Ninjakreborn Posted August 11, 2006 Author Share Posted August 11, 2006 I don't think xhtml has the potential to do this, but I was thinking php might. Quote Link to comment https://forums.phpfreaks.com/topic/17283-quick-help/#findComment-73343 Share on other sites More sharing options...
Orio Posted August 11, 2006 Share Posted August 11, 2006 Turn all of the "<" into < the ">" into > and it won't run.Orio. Quote Link to comment https://forums.phpfreaks.com/topic/17283-quick-help/#findComment-73348 Share on other sites More sharing options...
Ninjakreborn Posted August 11, 2006 Author Share Posted August 11, 2006 I am not trying to disable it from running necessarily, well I am, but I can't break the code. I want a universal way to do it, are there any xhtml, or php tags to do it. FOr instance, if you go to w3schools, they ahve tutorials in every language, ado, php, asp, javascritp, xhtml, xml. For those languages they always have code snippets, and code examples, showing what the code looks like behind the scenes, what tags do they use to do that?? Quote Link to comment https://forums.phpfreaks.com/topic/17283-quick-help/#findComment-73350 Share on other sites More sharing options...
AndyB Posted August 11, 2006 Share Posted August 11, 2006 third time lucky? Convert the < and > characters into their entity versions .... http://ca.php.net/manual/en/function.htmlentities.php Quote Link to comment https://forums.phpfreaks.com/topic/17283-quick-help/#findComment-73381 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.