Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Forum Module /

Discuss the Forum Module.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

PHP Syntax Highlighting

Go to End

9 Posts   3137 Views

Carbon Crayon

Community Member, 598 Posts

15 January 2009 at 11:36am

Edited: 15/01/2009 11:36am

having used the forums a lot lately (and loving the work you guys have done recently!) I think the one thing that makes communicating code that much harder is the lack of syntax highlighting. If we had that it would really bring the support up a least if feels like it would.
How difficult would it be to implement a highlighting script like this one?:

just a though :)


Community Member, 244 Posts

15 January 2009 at 11:44am

Edited: 15/01/2009 11:44am


Forum Moderator, 5523 Posts

15 January 2009 at 12:00pm

Well ideally we shouldn't have large chunks of PHP code on the forum and as it kinda makes posts quite long. Would be good if people all used or similar to paste links to their code.

But I will look into adding Syntax highlighting to the BBCode Parser (I thought it had it at one stage)

Carbon Crayon

Community Member, 598 Posts

15 January 2009 at 12:06pm

I see what your saying about making posts long, I know some of mine have been pretty monstrous. But at the same time sometimes it's definately worth posting a short function or two rather than linking externaly just to keep the post flowing.

I hadn't used pastie before but it looks pretty useful, I will start using it for my longer posts (although I couldnt get the highlighting on that to work either :( )


Community Member, 712 Posts

15 January 2009 at 2:47pm

Also, please please please could white space be preserved in code blocks?

class MyObjects {
    function LookReally() {
        return array(
            "ugly" => true


Forum Moderator, 4102 Posts

15 January 2009 at 3:58pm



Forum Moderator, 4102 Posts

15 January 2009 at 4:00pm

Has anyone tried the recipe on syntax highlighting in the docs? It's bloody awful. Did not work for me at all.

I use highlight,js, but the HTMLEditor in Silverstripe rips out the code tags for some reason. So it's a huge mess. And getting the indenting right is a massive headache.

Glad we have a dialogue going about this. Important issue.


Community Member, 16 Posts

26 January 2009 at 9:53pm

i tried that recipe on syntax highlighting, but it is missing some essential stuff.
I can't get it to work properly

Go to Top