Visual Studio.NET and PHP Coloring

Posted Sunday, February 22, 2004 3:31 PM by CumpsD

This post has been moved to http://blog.cumps.be/visual-studio-2008-and-php-coloring/ where you can find more information. (with screenshots!)

Archived version below
-----------------------------

Visual Studio is a great editor! But when editing other file formats I miss the coloring.

I'm a PHP coder as well (coming from the fact that I don't like Classic ASP) and I use VS.NET for editing my PHP files as well. And guess what, that's another file format, so no coloring. But I want it, badly.

So, here's the solution:

Download this .zip file, and extract it somewhere.

Run the registry file that matches your VS.NET editor. (The only difference is the 7.0 to 7.1 from 2002 to 2003).

Now copy usertype.dat to your VS.NET directory (default: C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE).

If VS.NET is running, close it and restart.

Now just open a .php file, and admire the coloring. And the '+' signs to collapse functions also work as a nice extra!

Filed under: ,

Comments

# re: Visual Studio.NET and PHP Coloring

Sunday, February 22, 2004 9:42 AM by Dhoore

nice tool! it's very usefull, thanks!

# PHP syntax highlighting in VS.Net

Sunday, February 22, 2004 5:48 PM by TrackBack

PHP syntax highlighting in VS.Net

# PHP Syntax Coloring with Visual Studio.NET

Sunday, February 22, 2004 7:12 PM by TrackBack

PHP Syntax Coloring with Visual Studio.NET

# re: Visual Studio.NET and PHP Coloring

Sunday, February 22, 2004 7:14 PM by CyberWolf

very useful
thanks from another php coder ;)

# PHP Code highlighting in Visual Studio .NET

Monday, February 23, 2004 7:59 AM by TrackBack

PHP Code highlighting in Visual Studio .NET

# re: Visual Studio.NET and PHP Coloring

Monday, February 23, 2004 10:47 AM by Anonymus333

Thanx to another "open" programmer...

# re: Visual Studio.NET and PHP Coloring

Thursday, February 26, 2004 5:46 PM by Bertg

hmmm,
I tought i found that one a while back :p

still waiting for the intellisense plugin for PHP :)

# re: Visual Studio.NET and PHP Coloring

Sunday, March 14, 2004 5:34 AM by Rock

Rock

# Labo.net

Friday, March 19, 2004 2:08 PM by TrackBack

Labo.net

# re: Visual Studio.NET and PHP Coloring

Saturday, March 20, 2004 3:50 PM by edgecrush3r

WHhhhhaaaa.. YOU SAVED MY DAY !!!!! ") Thank you God,!!

# re: Visual Studio.NET and PHP Coloring

Saturday, March 20, 2004 7:41 PM by Mike Knebel

Thank You VERY MUCH!

# re: Visual Studio.NET and PHP Coloring

Monday, April 19, 2004 9:05 AM by mike

top job. i'v ealtered the regs file for actionscript *.as files, lovely job.

# re: Visual Studio.NET and PHP Coloring

Thursday, May 06, 2004 2:00 PM by david

doesn't work for me on VS 7.0.

# re: Visual Studio.NET and PHP Coloring

Wednesday, May 19, 2004 7:59 AM by Simo

Very very cool

# re: Visual Studio.NET and PHP Coloring

Wednesday, May 19, 2004 8:01 AM by Simo

Yea, this does not work in Visual Studio .NET 2002. Can anyone help?

# re: Visual Studio.NET and PHP Coloring

Wednesday, May 19, 2004 8:04 AM by David Cumps

I believe it is a matter of changing the .reg file, to 7.0 if I remember correctly

# re: Visual Studio.NET and PHP Coloring

Wednesday, May 19, 2004 8:11 AM by Simo

I used the "php_edit2002.reg" which is for 7.0 and it did not work.

# re: Visual Studio.NET and PHP Coloring

Wednesday, May 19, 2004 8:18 AM by David Cumps

Then I don't have a clue, but this might be a nice alternative:

http://www.jcxsoftware.com/jcx.corporate6/

(If it works for vs2k2)

I'm using it now on 2k3, and it's really nice :)

# re: Visual Studio.NET and PHP Coloring

Wednesday, May 19, 2004 8:20 AM by Simo

Nope that doesn't work on 2002 either =(. Is there an update from 7.0 to 7.1 or did us 7.0 owners just get shafted?

# re: Visual Studio.NET and PHP Coloring

Wednesday, May 19, 2004 8:35 AM by David Cumps

Not sure, maybe this works:
http://www.codeguru.com/Cpp/V-S/tips/syntaxhighlighting/article.php/c471/

It uses the usertype.dat file as well, and if that doesn't work, I really have no idea. It's a tweak after all :p

# re: Visual Studio.NET and PHP Coloring

Wednesday, June 16, 2004 12:52 PM by allegro

VERY COOL!! Now if only I could find the same for .cfm as well.

# re: Visual Studio.NET and PHP Coloring

Friday, June 18, 2004 11:13 AM by -- adds --

Doesn't work for me either.

This is because i do not have C# or C++ installed with my VS.NET ....

# re: Visual Studio.NET and PHP Coloring

Wednesday, July 28, 2004 8:40 AM by ASP.Confused

THANKS!!! Works great for me in VS 2002. :o)

# re: Visual Studio.NET and PHP Coloring

Sunday, January 07, 2007 10:39 PM by Sherif

a FULL PHP IDE is available now from

www.jcxsoftware.com, it is built on top of Visual Studio.NET

it works great, and very powerfull debugger :)

# re: Visual Studio.NET and PHP Coloring

Thursday, February 01, 2007 1:45 PM by Second Executive Assistant to the Emperor of Omicron Persei 8

Thanks, cause it works in VS2005. Yay!

# re: Visual Studio.NET and PHP Coloring

Monday, February 05, 2007 1:52 AM by Catalyst

If you come across this looking to color code php in VS2005 there's a simpler way.

Go to Tools>Options>Text Editor

Type 'php' into the 'Extension:',  change 'Editor:' to 'HTML Editor' then click Add then OK.

Open a php file and it will be color coded.

# PHP syntax i Visual Studio 2005

Thursday, February 22, 2007 5:14 AM by PHP syntax i Visual Studio 2005

# re: Visual Studio.NET and PHP Coloring

Sunday, March 04, 2007 9:10 AM by Shelby Moore

The supplied fix only works for those who have Visual C++ installed with their Visual Studio, because the reg file associated .php extension with C++ syntax:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Languages\File Extensions\.php]

@="{B2F072B0-ABC1-11D0-9D62-00C04FD9DFD9}"

A "fix" is to associate .php with an installed language syntax.  For example, I have C# language support installed with my Visual Studio, this I can associate .php with C# syntax:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Languages\File Extensions\.php]

@="{694DD9B6-B865-4C5B-AD85-86356E9C88DC}"

Or you might sometimes want to associate .php with .html syntax:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Languages\File Extensions\.php]

@="{58E975A0-F8FE-11D2-A6AE-00104BCC7269}"

You might also want to read the following webpage, which lead me to this solution, and which explains how to edit the registry settings for other versions of Visual Studio:

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4196

Also an explanation of the usertype.dat file:

http://www.codeguru.com/Cpp/V-S/tips/syntaxhighlighting/article.php/c471/#more

Thanks to all for this syntax highlighting solution, as this greatly speed my work and lessens eye strain and errors.

Shelby Moore

CEO & CTO

http://CoolPage.com

For those who want to protect their wealth:

http://Miningpedia.com

# re: Visual Studio.NET and PHP Coloring

Monday, March 05, 2007 6:10 PM by Shelby Moore

I have found the free Komodo Edit 4.0, to be very similar interface to Visual Studio, and superior syntax highlighting for PHP with embedded Javascript, HTML, and XML:

http://www.activestate.com/products/komodo_edit/

Shelby Moore

CEO & CTO

http://CoolPage.com

For those who want to protect their wealth:

http://MiningPedia.com

# re: Visual Studio.NET and PHP Coloring

Friday, May 04, 2007 9:11 AM by spintz

Here's an updated usertype.dat file I created, with EVERY php function in it -

http://www.spintz.com/usertype.dat

# re: Visual Studio.NET and PHP Coloring

Friday, May 04, 2007 9:33 AM by spintz

And here's a zip file, with the updated usertype.dat file as well as a .reg file for VS2005.

http://www.spintz.com/vs-php.zip

# Visual Studio 2005 & PHP

Monday, June 11, 2007 12:55 PM by Andrea Azzola

In order to save up money instead of buying addictive editors for PHP (we love coloring & formatting

# Visual Studio 2008 and PHP Coloring

Wednesday, August 08, 2007 6:08 PM by David Cumps

Long ago, I write a post about Visual Studio.NET and PHP Coloring . Today I'm revisting the approach

# Microsoft Visual Studio e PHP - CriticalSection

Saturday, March 08, 2008 10:02 AM by Microsoft Visual Studio e PHP - CriticalSection

Pingback from  Microsoft Visual Studio e PHP - CriticalSection

# Visual Studio 2005/2008

Friday, June 13, 2008 8:15 AM by BRk's blog

Visual Studio 2005/2008