Highlighted

want allman code formatting on php code in dreamweaver 2020

New Here ,
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

646

Likes

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

want allman code formatting on php code in dreamweaver 2020

New Here ,
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

647

Likes

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
Apr 12, 2020 0
New Here ,
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();
}

 

Likes

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
Reply
Loading...
Apr 12, 2020 0
Adobe Community Professional ,
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, ACP - www.webspectrum.co.uk

Likes

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
Reply
Loading...
Apr 12, 2020 0
New Here ,
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

{

}

Likes

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
Reply
Loading...
Apr 14, 2020 0
Adobe Community Professional ,
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, ACP - www.webspectrum.co.uk

Likes

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
Reply
Loading...
Apr 15, 2020 0
New Here ,
Apr 17, 2020

Copy link to clipboard

Copied

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

it show 

if()

{

}

else {

}

Likes

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
Reply
Loading...
Apr 17, 2020 0
New Here ,
Apr 17, 2020

Copy link to clipboard

Copied

Annotation 2020-04-17 181337.png

 

Likes

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
Reply
Loading...
Apr 17, 2020 0
New Here ,
Apr 17, 2020

Copy link to clipboard

Copied

Annotation 2020-04-17 181705.png

Likes

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
Reply
Loading...
Apr 17, 2020 0
Paul-M LATEST
Adobe Community Professional ,
Apr 17, 2020

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.

 


Paul-M, ACP - www.webspectrum.co.uk

Likes

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
Reply
Loading...
Apr 17, 2020 0