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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Forum Module /

Discuss the Forum Module.

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

PHP Syntax Highlighting


Go to End


9 Posts   4347 Views

Avatar
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 level....at least if feels like it would.
How difficult would it be to implement a highlighting script like this one?: http://scott.yang.id.au/2003/01/source-code-syntax-highlighting-in-php/

just a though :)

Avatar
ajshort

Community Member, 244 Posts

15 January 2009 at 11:44am

Edited: 15/01/2009 11:44am

Avatar
Willr

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 pastie.org 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)

Avatar
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 :( )

Avatar
Hamish

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
        );
    }
}

Avatar
UncleCheese

Forum Moderator, 4102 Posts

15 January 2009 at 3:58pm

Second!!!!

Avatar
UncleCheese

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.

Avatar
lxer

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