Jump to content

How do I change the default code language?


Recommended Posts

The code editor always seems to default to HTML.  This is annoying for programming boards who don't use any HTML.

I've found that the theme is responsible for this, and the html template at core/global/editor/code presents the main editor.  If you hit variables, you'll see this:

Screenshot 2016-09-13 20.09.48.png

However, changing the string from 'html' to anything else doesn't seem to work. It always defaults to HTML no matter what.


Would appreciate some guidance on how to change the default language.

Link to comment
Share on other sites

For anyone interested in solving this problem, the following fix worked for me.  It's hacky but does the job.

Enter ACP->Customisation->Themes.

For your theme, edit the HTML and CSS.  Open the core/global/editor/code file. 

On line 10, you should see the following line:

					<select id='elCodeMode{$randomString}' data-role="codeModeSelect" data-codeLanguage="{$language}">

Change it to the following instead:

					<select id='elCodeMode{$randomString}' data-role="codeModeSelect" data-codeLanguage="{{if $val == ''}}YOURLANG{{else}}$language{{endif}}">

Replace "YOURLANG" with the language you want to be default.  For example 'php' or 'xml'.  It should be lowercase.

Good luck.

Link to comment
Share on other sites


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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...