Copy link to clipboard
Copied
Dear team,
I want Allman code formating on php code.
i use .jsbeautifyrc process display in below link.
https://helpx.adobe.com/in/dreamweaver/using/format-code.html
but in if else condition display code
if()
{
}
else {
}
but i want
if()
{
}else
{
}
please help me.
thanks.
Copy link to clipboard
Copied
http://www.terminally-incoherent.com/blog/2009/04/10/the-only-correct-indent-style/
Allman
if (x == y)
{
x++;
foo();
}
else
{
x--;
bar();
}
Copy link to clipboard
Copied
Limited PHP code formatting options are in this file on windows (make a backup of the file first):
C:\Program Files\Adobe\Adobe Dreamweaver Next\www\extensions\default\BracketsDWBeautify\default.jsbeautifyrc - at the bottom PHP otions for format source code look something like this :
"php": {
"eol": "\n",
"preserve_newlines": true,
"max_preserve_newlines": 3,
"space_after_anon_function": true,
"brace_style": "collapse",
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"break_chained_methods": false,
"eval_code": false,
"unescape_strings": false,
"wrap_line_length": 0,
"wrap_attributes": "auto",
"end_with_newline": false,
"comma_first": false,
"space_in_paren":true
}
Alternatively you can put a .jsbeautifyrc file in the root of your current project
Copy link to clipboard
Copied
i already done but after else brace no go in new line
if()
{
}
else {
}
but i want
if()
{
}else
{
}
Copy link to clipboard
Copied
This setting will get you closer to you what your looking for:
change:
"brace_style": "collapse",
to:
"brace_style": "expand",
Copy link to clipboard
Copied
i already done but after else brace not go in next line
it show
if()
{
}
else {
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I don't think what you want is possible with the standard settings, you'd have to look at the editing the file located here C:\Program Files\Adobe\Adobe Dreamweaver 2020t\www\extensions\default\BracketsDWBeautify\thirdparty\beautify-php.js
The code editor is based on brackets and it uses js-beautify for formatting code, the Adobe devs have created a js-beautify plug in for PHP formatting so you could make a request for allman style braces here.