• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

want allman code formatting on php code in dreamweaver 2020

New Here ,
Apr 12, 2020 Apr 12, 2020

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. 

Views

828

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 12, 2020 Apr 12, 2020

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 12, 2020 Apr 12, 2020

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

Paul-M - Community Expert

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 14, 2020 Apr 14, 2020

Copy link to clipboard

Copied

i already done but after else brace no go in new line

 

if()

{

}

else {

}

but i want

if()

{

}else

{

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 15, 2020 Apr 15, 2020

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",

Paul-M - Community Expert

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 17, 2020 Apr 17, 2020

Copy link to clipboard

Copied

i already done but after else brace not go in next line

it show 

if()

{

}

else {

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 17, 2020 Apr 17, 2020

Copy link to clipboard

Copied

Annotation 2020-04-17 181337.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 17, 2020 Apr 17, 2020

Copy link to clipboard

Copied

Annotation 2020-04-17 181705.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 17, 2020 Apr 17, 2020

Copy link to clipboard

Copied

LATEST

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.

 

Paul-M - Community Expert

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines