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

Apply Source Formatting not working

Community Beginner ,
Oct 03, 2020 Oct 03, 2020

When I try to apply source formatting, nothing gets formatted. 

 

Is there any way for me to debug this - to figure you what in my code is causing it to fail?

659
Translate
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 ,
Oct 03, 2020 Oct 03, 2020

What kind of file is it? 

If it's HTML, use the built-in validation service.  Go to Window > Results > Validation.  Click on the white triangle to check your document.   Fix all reported errors.

 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
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 Beginner ,
Oct 03, 2020 Oct 03, 2020

Nancy - It's a PHP file.  There are no errors or warnings reported by validation.  This is not caused by invalid HTML or PHP code. 

Translate
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 ,
Oct 03, 2020 Oct 03, 2020

Which version of DW?

Did you format PHP tag libraries before running Apply Source Formatting? 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
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 Beginner ,
Oct 11, 2020 Oct 11, 2020

It's the latest version. 

i have never looked the code tag libraries. 

I can't imagine that in building the tool there was no debug facility 

Translate
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 Beginner ,
Oct 11, 2020 Oct 11, 2020

I should mention that it works on a stripped down version of the page with only a few lines on HTML, PHP, and Template commands. 

Translate
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 ,
Oct 12, 2020 Oct 12, 2020

Hi,

 

We need to see the full page/source code really to help with this....  Can you post it?

Paul-M - Community Expert
Translate
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
LEGEND ,
Oct 12, 2020 Oct 12, 2020

As far as I know DW doesnt specifically have a debugger for php, you'd have to use something like Xdebug. I dont know if DW has any options for executing Xdebug.

 

On the other hand I doubt debugging has anything to do with applying code source formatting or stopping it from working.

 

Translate
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 ,
Oct 14, 2020 Oct 14, 2020

Is your PHP a pure PHP file or does it contain HTML code?
if it's only PHP, it's been working pretty well (out of the box) for a few versions. then it's a matter of personal wishes and expectations that can easily be edited to refine the result.https://helpx.adobe.com/in/dreamweaver/user-guide.html/in/dreamweaver/using/format-code.ug.html


but as soon as PHP and HTML code is mixed, and depending on your method of block organization, it becomes more peculiar and often messy than we would expect. on this subject, if someone has a solution, I'll take it... thank you 😉

Translate
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 Beginner ,
Dec 02, 2020 Dec 02, 2020

Folks - I have clearly failed to make myself clear.  This is only about the "Apply Source Formatting" tool.  I like to use it to line up all the indents, lists, etc.  

  • I have some sites where it works fine, but on one particular site it refuses to format anything, so clearly something about this site causes the tool to stop before it does anything.  
  • The code passes validation with no errors or warnings, so it is not related to that.  
  • I would think there would be some way of finding out what about this site is causing the tool to fail - some debug reporting that can be turned on? 
  • I am not asking anyone to read my code and figure that out; that would be too presumptious.  index.php is almost 600 lines, so it would be a tedious task. 

I'm using DW 21 (with a template), PHP, CSS3, Windows 10, with local and remote servers defined.

One interesting fact is that "Apply Source Formatting" works fine on the template. 

Translate
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 ,
Dec 02, 2020 Dec 02, 2020

So you're trying to Apply  Code Formatting to a Template CHILD page.  That's a horse of a different color.  Only code inside an Editable Region will be effected.  Everything outside Editable Regions is necessarily controlled by your main Template.dwt. 

 

For best results, Apply Code Formatting to the Template.dwt and populate changes to child pages.

 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
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 Beginner ,
Dec 03, 2020 Dec 03, 2020

Nancy - I only expect it to work on code within editable regions.  But it doesn't.

There is a significant amount of code within the editable regions that I need it to work on.

 

Translate
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 Beginner ,
Dec 03, 2020 Dec 03, 2020

Oh, and the template syntax is correct, according to DW.

 

Translate
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 ,
Dec 03, 2020 Dec 03, 2020
LATEST

Since this only happens with one site, the site template could be corrupted.

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
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