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

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

Community Beginner ,
Nov 07, 2016 Nov 07, 2016

Copy link to clipboard

Copied

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"

Views

4.2K

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

correct answers 1 Correct answer

Community Beginner , Jan 08, 2018 Jan 08, 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 - ]\Applic

...

Votes

Translate

Translate
Community Beginner ,
Nov 10, 2016 Nov 10, 2016

Copy link to clipboard

Copied

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!

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 Beginner ,
Nov 11, 2016 Nov 11, 2016

Copy link to clipboard

Copied

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?

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 ,
Nov 11, 2016 Nov 11, 2016

Copy link to clipboard

Copied

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 & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

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 Beginner ,
Nov 11, 2016 Nov 11, 2016

Copy link to clipboard

Copied

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?

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 ,
Nov 11, 2016 Nov 11, 2016

Copy link to clipboard

Copied

I don't think so.  Unless there's an option for it inside one of the Brackets .json files that I'm not yet aware of.

Nancy O.

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

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 Beginner ,
Nov 11, 2016 Nov 11, 2016

Copy link to clipboard

Copied

I figured it out. You just need to do the stuff I tried in the first post.

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"

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 ,
Nov 11, 2016 Nov 11, 2016

Copy link to clipboard

Copied

Oh, and you will need to  modify or create an .htaccess file to parse HTML files as PHP.   Note:  Some shared hosting plans do not support this because it puts an extra load on the servers.  If unsure, contact your web host before doing this.  

AddHandler x-httpd-php .html .htm
AddHandler php-script .php .html .htm

AddHandler php5-script .php .html .htm

AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html

Nancy O.

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

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 ,
Dec 13, 2018 Dec 13, 2018

Copy link to clipboard

Copied

Same question, in CC 2019

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 ,
Dec 13, 2018 Dec 13, 2018

Copy link to clipboard

Copied

PHP code in an .HTML file will not work in any scenario unless the server or the .htaccess/config.sys  file has been modified.

Wappler, the only real Dreamweaver alternative.

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 ,
Dec 14, 2018 Dec 14, 2018

Copy link to clipboard

Copied

LATEST

I have it working when viewing the pages in my browser on my local test server. This was done by modifying the Apache hpptd.conf file. But it does not help Dreamweaver to recognize the php in the preview window.

I know a better solution is to rename the files to .php, but for reasons I won't go into, the client does not want this as an option.

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 ,
Nov 11, 2016 Nov 11, 2016

Copy link to clipboard

Copied

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

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
Adobe Employee ,
Dec 19, 2016 Dec 19, 2016

Copy link to clipboard

Copied

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

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 Beginner ,
Jan 08, 2018 Jan 08, 2018

Copy link to clipboard

Copied

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.

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 ,
Jan 08, 2018 Jan 08, 2018

Copy link to clipboard

Copied

[autoresponder email removed by moderator]

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 Beginner ,
Jan 08, 2018 Jan 08, 2018

Copy link to clipboard

Copied

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"

}

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 ,
Dec 13, 2018 Dec 13, 2018

Copy link to clipboard

Copied

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.

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