Jump to content

Archived

This topic is now archived and is closed to further replies.

Ninjakreborn

quick help

Recommended Posts

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, whatever
TO 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.

Share this post


Link to post
Share on other sites
[code]<pre>whatever</pre>[/code]

might help

Otherwise, convert < to & amp l t; and so on.

Share this post


Link to post
Share on other sites
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]<?php
echo "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.

Share this post


Link to post
Share on other sites
Turn all of the "<" into &lt; the ">" into &gt; and it won't run.

Orio.

Share this post


Link to post
Share on other sites
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??

Share this post


Link to post
Share on other sites
third time lucky?  Convert the < and > characters into their entity versions .... http://ca.php.net/manual/en/function.htmlentities.php

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.