Opening PHTML Files in Dreamweaver
Opening PHTML Files in Dreamweaver |
By default, Dreamweaver cannot read PHTML files. You can add the file type to the “Open in Code View” section of the preferences if you wish to have fast access, however you cannot view the file in design view if you do that. So if you use Dreamweaver (versions 4, MX, MX2004, 8, or 9, aka CS3) to design your sites, and you wish to open Magento’s Template files (they have .phtml extensions) in Dreamweaver, you can follow these steps to add support for .phtml and make Dreamweaver render PHP code (with coloring, hinting, et al) as well as allow you to see the design in code view if desired. Below are three steps to follow.*
IMPORTANT NOTES: This guide is for Dreamweaver on Windows (XP or Vista) or Mac OS X. Note: I have excluded version numbers from the file locations shown, and if you are using a version older than Dreamweaver 9 (CS3) replace “Adobe” with “Macromedia” in the file locations shown. Some spaces have also been removed to keep the references on one line.
* Dreamweaver 4 users: if you are using the archaic Dreamweaver 4, you only need to follow step one. However, it’s highly recommended that you just upgrade to version 8 or newer for superb CSS and Web Standards support.
*With Dreamweaver 8, this tip didn’t work for me, so I repeated Step 3 here: “C:\Documents and Settings\[user name]\Application Data\Macromedia\Dreamweaver 8\Configuration\DocumentTypes\MMDocumentTypes.xml” and PHTML finally worked in both Design View and Code view.
Step One: Add .phtml to the extension.txt configuration file |
Open the following extension configuration file in a notepad and change the lines as specified below:
XP, Vista: C:Program Files\Adobe\Dreamweaver\Configuration\Extensions.txt Mac OS X: Applications > Adobe Dreamweaver CS3 > configuration > Extensions.txt ==In the first line add PHTML like so:== HTM,HTML,SHTM,SHTML, ... ,TXT,PHP,PHP3,PHP4,PHP5,PHTML,JSP,WML,TPL, ... ,MASTER:All Documents ==In the PHP Files line add PHTML like so:== PHP,PHP3,PHP4,PHP5,PHTML,TPL,PHTML:PHP Files ===Step Two: Add .phtml to extension.txt in your Application Data=== This file is pretty much exactly like the extensions.txt file located in Dreamweaver’s configuration folder, except it is in your users Application Data folder (AppData folder for Vista users). Just as in Step One, find the file and change the lines as specified below. XP: C:Documents and Settings\[user]\ApplicationData\Adobe\Dreamweaver\Configurationextensions.txt Vista: C:Users\[user]\AppData\Roaming\Adobe\Dreamweaver\Configuration\Extensions.txt Mac OS X: Users > Library > Application Support > Adobe > Dreamweaver 9 > Configuration > Extensions.txt ==In the first line add PHTML like so:== HTM,HTML,SHTM,SHTML, ... ,TXT,PHP,PHP3,PHP4,PHP5,PHTML,JSP,WML,TPL, ... ,MASTER:All Documents
==In the PHP Files line add PHTML like so:== PHP,PHP3,PHP4,PHP5,PHTML,TPL,PHTML:PHP Files
===Step Three: Add PHTML to MMDocumentTypes.xml=== This file is an XML file which should be located in:
C:Program Files\Adobe\Dreamweaver\Configuration\DocumentTypes\MMDocumentTypes.XML
Mac OS X: Applications > Adobe Dreamweaver CS3 > configuration > DocumentTypes > MMDocumentTypes.XML
==Add PHTML to this line (approx. line 75) twice, like so:==//
<documenttype id="PHP_MySQL" servermodel="PHP MySQL" internaltype="Dynamic" winfileextension="php,php3,php4,php5,phtml" macfileextension="php,php3,php4,php5,phtml" file="Default.php" writebyteordermark="false">;
Restart or Open Dreamweaver and you shouldn’t have any problems with PHTML files any longer.


