hello,
today i visited the source code section of daniweb and i was amazed to see that codes inside text box were colored according to their syntax.here is the url of the page.
http://www.daniweb.com/code/snippet25.html
in which language this is coded .can i do this in php .can anybody provide me some help.perhaps cscgal can help me out.

Recommended Answers

All 5 Replies

The color coding was accomplished by a perl syntax highlighter known as the beautifier (www.beautifier.org), later ported to php. Alternatively, there are two built-in php functions known as highlight_string() and highlight_file() which output syntax highlighted PHP. For example,

<?php
highlight_string('<?php phpinfo(); ?>');
?>

For more information,
http://us4.php.net/manual/en/function.highlight-string.php
http://us4.php.net/manual/en/function.highlight-file.php

i thought i will not get reply, thats why i started coding my own function.my function replaced all the keywords with custom colors and it also changed the colors of the comments, but it had some bugs.but now i know the site i will be able to complete my function easily.

I use PHP Coder Pro.... Nice utility with some built in functionality... Best of all... it is FREE!

www.phpide.com/go/downloads.htm

hello cputek2k,
we are talking about highlighting source codes in web-pages not in IDE.if you know about it ,please tell me. the link u posted was down,but i guessed from the url that it could be IDE download site.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.