views:

40

answers:

2

I'd like to embed code from my SVN repository into my website, using PHP. The SVN has public anonymous access, so the PHP code should be fine reading it.

The code on said SVN is java, and so far I've had no luck finding a syntax-highlighter to make the code more readable. Ideally I'd like one that uses CSS classes so that I can change the colors to match the look of the website.

Could someone point me to a PHP library that highlights Java code?

+2  A: 

Have you considered GeSHi? It supports a lot of languages including Java. You have to enable classes to use CSS classes.

Yacoby
+1 for a really nice resource!
ivans
And including "LOLcode", it seems!
Eric
A: 

Redmine or Trac can be connected to your SVN repo and will allow you to browse the contents with syntax highlighting. Both packages can be themed, and there are plenty of web sites that base the entire site on them.

GeSHi as recommended by Yacoby is also another option. I use that on my Drupal-based web site and it works quite well. It doesn't connect directly to a SVN repo though - for that you'd need a separate library. See http://www.petercarrero.com/content/2009/10/23/getting-php-bindings-subversion for an excellent blog entry that explains how to do this.

Brian Showalter
Like I said, it's a public (ie read-only) SVN, so I can just use `file_get_contents()` to get the file. Beanstalkapp.com already does syntax highlighting for logged-in users.
Eric