Skip to main content
Inspiring
November 7, 2016
Answered

Color PHP code in .HTML documents? (Dw 2017)

  • November 7, 2016
  • 5 replies
  • 4926 views

In the previous version of Dreamweaver, I could edit two files as described below, and then all my PHP code, within .html documents, would show up colored as if I was opening a .php file. The method no longer seems to work in Dreamweaver CC 2017.

Does anyone know how to fix this? I'm only looking for a solution that will allow dreamweaver to handle the color coding as described above. I'm not interested in changing file types.

Here's how I did it before. Folders in Brackets are obviously different on each computer and version of adobe.

Extensions.txt Files:

[ - HD - ] \Applications\ [ - ADOBE DREAMWEAVER - ] \configuration\Extensions.txt

[ - HD - ] \Users\ [ - USER - ] \Library\Application Support\Adobe\ [ - DREAMWEAVER - ] \en_US\Extensions.txt

Org Text 1: HTML,HTM,HTA,HTC,XHTML:HTML Documents

New Text 1: HTM,HTA,HTC,XHTML:HTML Documents

Org Text 2: PHP,PHP3,PHP4,PHP5,TPL,PHP-DIST,PHTML:PHP Files

New Text 2: PHP,PHP3,PHP4,PHP5,TPL,PHP-DIST,PHTML,HTML:PHP Files

MMDocumentTypes.xml Files:

[ - HD - ]\Applications\[ - ADOBE DREAMWEAVER - ]\configuration\DocumentTypes\MMDocumentTypes.xml

[ - HD - ]\Users\[ - USER - ]\Library\Application Support\Adobe\[ - DREAMWEAVER - ]\en_US\DocumentTypes\MMDocumentTypes.xml

Org Text 1:

winfileextension="html,htm,shtml,shtm,stm,tpl,lasso,xhtml"

macfileextension="html,htm,shtml,shtm,tpl,lasso,xhtml,ssi"

New Text 1:

winfileextension="htm,shtml,shtm,stm,tpl,lasso,xhtml"

macfileextension="htm,shtml,shtm,tpl,lasso,xhtml,ssi"

Org Text 2:

winfileextension="php,php3,php4,php5,phtml"

macfileextension="php,php3,php4,php5,phtml"

New Text 2:

winfileextension="php,php3,php4,php5,phtml,html"

macfileextension="php,php3,php4,php5,phtml,html"

    This topic has been closed for replies.
    Correct answer TheArin

    Update for 2018:

    Extensions.txt Files:

    [ - HD - ] \Applications\ [ - ADOBE DREAMWEAVER - ] \configuration\Extensions.txt

    [ - HD - ] \Users\ [ - USER - ] \Library\Application Support\Adobe\ [ - DREAMWEAVER - ] \en_US\Configuration\Extensions.txt

    Org Text 1: HTML,HTM,HTA,HTC,XHTML:HTML Documents

    New Text 1: HTM,HTA,HTC,XHTML:HTML Documents

    Org Text 2: PHP,PHP3,PHP4,PHP5,TPL,PHP-DIST,PHTML:PHP Files

    New Text 2: PHP,PHP3,PHP4,PHP5,TPL,PHP-DIST,PHTML,HTML:PHP Files

    MMDocumentTypes.xml Files:

    [ - HD - ]\Applications\[ - ADOBE DREAMWEAVER - ]\configuration\DocumentTypes\MMDocumentTypes.xml

    [ - HD - ]\Users\[ - USER - ]\Library\Application Support\Adobe\[ - DREAMWEAVER - ]\en_US\Configuration\DocumentTypes\MMDocumentTypes.xml

    Org Text 1:

    winfileextension="html,htm,shtml,shtm,stm,tpl,lasso,xhtml"

    macfileextension="html,htm,shtml,shtm,tpl,lasso,xhtml,ssi"

    New Text 1:

    winfileextension="htm,shtml,shtm,stm,tpl,lasso,xhtml"

    macfileextension="htm,shtml,shtm,tpl,lasso,xhtml,ssi"

    Org Text 2:

    winfileextension="php,php3,php4,php5,phtml"

    macfileextension="php,php3,php4,php5,phtml"

    New Text 2:

    winfileextension="php,php3,php4,php5,phtml,html"

    macfileextension="php,php3,php4,php5,phtml,html"

    brackets.json File:

    [ - HD - ]\Users\[ - USER - ]\Library\Application Support\Adobe\[ - DREAMWEAVER - ]\en_US\Configuration\Brackets\brackets.json

    Add:

    "language.fileExtensions": {

         "html": "php"

    }

    5 replies

    TheArinAuthorCorrect answer
    Inspiring
    January 8, 2018

    Update for 2018:

    Extensions.txt Files:

    [ - HD - ] \Applications\ [ - ADOBE DREAMWEAVER - ] \configuration\Extensions.txt

    [ - HD - ] \Users\ [ - USER - ] \Library\Application Support\Adobe\ [ - DREAMWEAVER - ] \en_US\Configuration\Extensions.txt

    Org Text 1: HTML,HTM,HTA,HTC,XHTML:HTML Documents

    New Text 1: HTM,HTA,HTC,XHTML:HTML Documents

    Org Text 2: PHP,PHP3,PHP4,PHP5,TPL,PHP-DIST,PHTML:PHP Files

    New Text 2: PHP,PHP3,PHP4,PHP5,TPL,PHP-DIST,PHTML,HTML:PHP Files

    MMDocumentTypes.xml Files:

    [ - HD - ]\Applications\[ - ADOBE DREAMWEAVER - ]\configuration\DocumentTypes\MMDocumentTypes.xml

    [ - HD - ]\Users\[ - USER - ]\Library\Application Support\Adobe\[ - DREAMWEAVER - ]\en_US\Configuration\DocumentTypes\MMDocumentTypes.xml

    Org Text 1:

    winfileextension="html,htm,shtml,shtm,stm,tpl,lasso,xhtml"

    macfileextension="html,htm,shtml,shtm,tpl,lasso,xhtml,ssi"

    New Text 1:

    winfileextension="htm,shtml,shtm,stm,tpl,lasso,xhtml"

    macfileextension="htm,shtml,shtm,tpl,lasso,xhtml,ssi"

    Org Text 2:

    winfileextension="php,php3,php4,php5,phtml"

    macfileextension="php,php3,php4,php5,phtml"

    New Text 2:

    winfileextension="php,php3,php4,php5,phtml,html"

    macfileextension="php,php3,php4,php5,phtml,html"

    brackets.json File:

    [ - HD - ]\Users\[ - USER - ]\Library\Application Support\Adobe\[ - DREAMWEAVER - ]\en_US\Configuration\Brackets\brackets.json

    Add:

    "language.fileExtensions": {

         "html": "php"

    }

    MikemanR
    Participant
    December 13, 2018

    Did this get live preview working when PHP was added to .HTML files?

    If so it seems to be broken in CC 2019.

    Any ideas?

    FYI I'm using XAMPP and files with a .PHP extension work fine, but when renamed, they break in preview.

    They work fine outside of Dreamweaver, in any browser.

    TheArinAuthor
    Inspiring
    January 8, 2018

    If anyone follows up on this thread, The "Correct Answer" isn't the correct answer. Also, the post that helped a bunch, was removed. Here's what was originally said in that post from "scott"

    Thanks for the reply but the old solution for adding file extensions and setting document type does not work. I actually figured out the new solution. Go to: C:\Users\[username]\AppData\Roaming\Adobe\Dreamweaver CC 2017\en_US\Configuration\Brackets and edit the brackets.json file to include:

    "language.fileExtensions": {

         "inc": "html",

         "liquid": "html"

    }

    Did the trick for me.

    Participant
    January 8, 2018

    [autoresponder email removed by moderator]

    Legend
    November 12, 2016

    Please post a vote here so we can hopefully get full flexibility back for code colouring:

    Restore Full Code Colouring Flexibility – Adobe Dreamweaver CC: Feature Ideas

    The code colouring apart from being removed from the prferences because it's a half finished Brackets integration lacks serious flexibility, no language specific option even if you are prepared to edit the LESS theme file directly has been included.

    I had an official response from Adobe that language-specific code colouring which is a feature in Brackets, is NOT included in the brackets integration with Dreamweaver.

    Paul-M - Community Expert
    Preran
    Community Manager
    Community Manager
    December 19, 2016

    Hi everyone,

    Please update to the latest version of Dreamweaver 2017.0.1 where most issues with code coloring have been addressed.

    See Dreamweaver 2017.0.1 is now live  for more info.

    This document  https://helpx.adobe.com/dreamweaver/using/customize-code-coloring.html has been updated to reflect changes.

    Thanks,

    Preran

    TheArinAuthor
    Inspiring
    November 11, 2016

    So next question. Does anyone know how to make dreamweaver treat a .html file as a .php file for the live preview and listing of linked source code files?

    Nancy OShea
    Community Expert
    Community Expert
    November 11, 2016

    I don't think that's possible.  To work with PHP files, you really need a local testing server installed on your machine  -- either Wamp, Xampp or Mamp.

    To Preview in Browser with a localhost testing server, use right-click on open document Tab or files in Files Panel (F8).  Select "Open in Browser."

    Nancy O.

    Nancy O'Shea— Product User & Community Expert
    TheArinAuthor
    Inspiring
    November 11, 2016

    I'm using the local apache server baked into my macbook pro.

    The site I'm working uses a php include for the header and footer on each document. I changed the server to understand and process .html files as .php (I know this isn't the best way to do it, converting all files to a .php extension isn't an option at this time).

    With that said, if I load a .html file in dreamweaver, that has a php include at the top and bottom of the file, and do the live preview, it doesn't show the content, and doesn't show the linked files such as my style sheets. But if the same file has a .php extension, everything loads just fine.

    So, is there a way to make dreamweaver render .html files as if they had a .php extension?

    TheArinAuthor
    Inspiring
    November 10, 2016

    Scott, this is what I was after! Thank you.

    I went in and added the following after the last item:

    "language.fileExtensions": {

         "html": "php"

    }

    *** For anyone else looking at this, make sure you add a , after the line just above, like this in red:

    "showSyntaxColoring": true,

    "language.fileExtensions": {

         "html": "php"

    }

    I also followed pziecina's post to get coloring different.

    Now my html documents open and default to php coloring.

    Thanks!