Skip navigation
Currently Being Moderated

working with .phtml files in dreamweaver... a how to

Apr 13, 2010 7:53 AM

hope this helps those diving into magento, zend, and other goodies, but want the comfort of dreamweaver.  would be nice if it came this way, but it's an easy add for 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,CS4) 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, CS3 or newer for superb CSS and Web Standards support.

 

* Vista may need to edit files by running notepad as Administrator, however this requirement is not common and if encountered, may be avoidable by following these steps after a fresh restart. However, if unavoidable, simply go to Start > All Programs > Accessories, and then right click on Notepad and select “Run as Administrator”. Once notepad is open, use File > Open to browse to the applicable file before making the necessary changes.

 

 

 

Open the following extension configuration file in a notepad and change the lines as specified below:

XP: Documents and Settings > [user] > Application Data > Adobe Dreamweaver > Configuration > extensions.txt

NOTE: If you cannot see the Application Data Folder, go to Tools → Folder Options → View and make sure that Show Hidden Files and Folders is checked.

Vista: Users > [user] > AppData > Roaming > Adobe > Dreamweaver 9 > Configuration > Extensions.txt

Mac OS X: Users > [Home Folder] >Library > Application Support > Adobe > Dreamweaver [Your Version] > [en_US or other locale (only for version CS4)] > Configuration > Extensions.txt

HTM,HTML,SHTM,SHTML, ... ,TXT,PHP,PHP3,PHP4,PHP5,PHTML,JSP,WML,TPL, ... ,MASTER:All Documents



PHP
,PHP3,PHP4,PHP5,TPL,PHTML:PHP Files

This file is pretty much exactly like the extensions.txt file located in Dreamweaver’s Application Data folder, except it is in Dreamweaver’s Program Files folder, inside a configuration folder. Just as in Step One, find the file and change the lines as specified below.

XP, Vista: Program Files > Adobe > Dreamweaver [Your Version] > configuration > Extensions.txt

Mac OS X: Applications > Adobe Dreamweaver [Your Version] > configuration > Extensions.txt

 

 

HTM,HTML,SHTM,SHTML, ... ,TXT,PHP,PHP3,PHP4,PHP5,PHTML,JSP,WML,TPL, ... ,MASTER:All Documents

PHP,PHP3,PHP4,PHP5,TPL,PHTML:PHP Files

 

 

This will apply your php code coloring settings to your phtml files This file is an XML file which should be located in:

XP, Vista: Program Files > Adobe > Dreamweaver [Your Version] > configuration > DocumentTypes > MMDocumentTypes.xml

Mac OS X: Applications > Adobe Dreamweaver [Your Version] > configuration > DocumentTypes > MMDocumentTypes.XML

Note: Dreamweaver 8 users on Windows may also need to apply these changes to: C:Program Files > Macromedia > Dreamweaver 8 > Configuration > Document Types > MMDocumentTypes.xml

Note: In Windows 7/Vista you may need to update the file permissions under Properties>Security tab in order to save your changes to the file.

<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">;
</documenttype>

Restart or Open Dreamweaver and you shouldn’t have any problems with PHTML files any longer.

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points