Jump to content

Recommended Posts

I've taken over a PHP application and all of the pages are saved as .html. Consequently, Dreamweaver isn't applying the normal syntax coloring to the PHP code as it would if the pages were saved as .php.

 

Has anyone encountered this or know how I might get Dreamweaver to recognize the PHP without having to change the file extentions to .php?

 

Much appreciated!

 

-jonas

 

Link to comment
https://forums.phpfreaks.com/topic/1822-syntax-coloring/
Share on other sites

  • 4 weeks later...

The whole point of syntax colouring is to be able to differenciate. Why would you want php syntax colouring with HTML. To make the site compliant for dreamweaver make all pages .php. Dreamweaver should update links accordingly but if not the use the links sitewide option later. Tag the php code with <?php ?>

to seperate it from the HTML and Dreamweaver will colour both syntax correctly.

 

Sounds like the php application is using HTML templates and should be so easy to manage in Dreamweaver. A lot of developers like to keep HTML seperate from the server side code for ease of management. Im afraid if your stuggling with editing a site set out in this way, then you took on a project that is too deep for you.

 

Link to comment
https://forums.phpfreaks.com/topic/1822-syntax-coloring/#findComment-6057
Share on other sites

morpheus.100-

 

I understand the concept of syntax coloring as well as how to use php tags within html. That is not what I'm asking. The files are SAVED with a .html extension, therefore not applying the syntax coloring at all. Simply resaving the files with a .php file extension is not an option as the site was intentionally designed this way.

 

I'm not struggling nor is the project too deep for me. Perhaps you should read postings more clearly before replying.

Link to comment
https://forums.phpfreaks.com/topic/1822-syntax-coloring/#findComment-6065
Share on other sites

And perhaps you should understand the application your TRYING to use!

Dreamweaver will only colour both syntax in the same document if it has a .php extension. HTML pages are only intended as static documents or templates, so why would dreamweaver need to colour a server sode code which didnt ought to be there. If the document is specified as server side ie .php extension then it is written to understand there may be server side code and will colour accordigly.

 

Press F1 at any time and read the manaul. It has the answers. Follow the tutorials and learn from them. Surely it must be a more lengthy exercise to log on, log in, post a topic, and await replies.

Link to comment
https://forums.phpfreaks.com/topic/1822-syntax-coloring/#findComment-6066
Share on other sites

dreamweaver code coloring

 

on Windows XP

[users]\[Applications...don't know in english]\Macormedia\Dreamweaver MX\Configuration\CodeColoring

 

edit file CodeColoring.xml (after making a copy of the original;))

 

search for

<scheme name = "PHP-Script" id="PHP_Script" priority="20">

 

change any

doctypes="PHP_MySQL"

 

to

doctypes="PHP_MySQL,HTML"

 

restart dreamweaver

 

cheers

martin

Link to comment
https://forums.phpfreaks.com/topic/1822-syntax-coloring/#findComment-6076
Share on other sites

  • 1 month later...
  • 4 weeks later...

jonas11,

 

You are correct in wanting Dreamweaver to to do more than it does out of the box.. In fact, the manuals for Dreamweaver rage on about how it is highly configurable... That's just all they tell you...

 

Who cares why you want to do it.. The answer is YES, it can do color coding in any way you want.. Why just blindly stick to the defaults setup by others?? WHat a bland way to look at things - it usually just gives people a useless hostile attitude :)

 

The problem is that ever since Macromedia bought Alair (originators of Cold Fusion), the documentation for Dreamweaver(now a Dreamweaver/ColdFusionStudio Hybrid), the documentation on configuration has gone down hill..

 

Here is a quick overview of the parts of the COdeColoring file and what you would change - and why..

 

In the CodeColoring.xml file under your user prefs/app data/Macromedia.../config...etc

 

Look for:

<scheme name="PHP Script" (around line 1250 or so..)

 

This is where it is all defined.. Now look for lines like this:

 

<blockStart doctypes="PHP_MySQL" scheme="customText"><![CDATA[<?\n]]></blockStart>

 

There are about 5 of them.. In this example, the <?\n says that php starts with a tag like this <? [newline]

 

You and even add more like <blockStart doctypes="PHP_MySQL" scheme="customText"><![CDATA[<this is fun and you wont find it under F1>]]></blockStart>

with an ending tag like:

<blockEnd ><![CDATA[</this is fun and you wont find it under F1>]]></blockEnd>

 

Giving you:

<this is fun and you wont find it under F1>PHP CODE ALL YOU WANT AND SEE IT COLOR CODED IN .HTML FILES</this is fun and you wont find it under F1>

 

 

 

 

Each <BlockStart defines the opening tags for PHP blocks..

 

The Problem is that the doctype directive states that Dreamweaver is only allowed to color-code php blocks within php pages... doctypes="PHP_MySQL" hmmmm...

 

Soo for each <blockStart, change the doctypes directive from

doctypes="PHP_MySQL"

to

doctypes="PHP_MySQL,HTML"

 

I just copied the entire list from the html scheme at the top of the colorCoding.xml file:

doctypes="ASP.NET_VB,ASP.NET_CSharp,ASP-JS,ASP-VB,ColdFusion,CFC,HTML,JSP,EDML,PHP_MySQL,LibraryItem,WML"

 

 

To change the colors:

edit->preferences->Color COding->HTML->PHP

NOT

edit->preferences->Color COding->PHP (this will just change the colors in .php-ish named files, not html files..

 

Warning:

If editing in Dreamweaver, dreamweaver may hiccup on this huge file.. you may need to save a copy as txt and edit then rename as xml

 

 

I have posted my file at:

http://www.clickalive.com/david/Macromedia/CodeColoring.xml

 

Oh yeah.. I use: http://www.vim.org - even when I get stuck using a Windows machine..

 

Link to comment
https://forums.phpfreaks.com/topic/1822-syntax-coloring/#findComment-6259
Share on other sites

  • 2 months later...

I fought with this forever because I kept editing the "C:\Program Files\Macromedia\Dreamweaver MX 2004\Configuration\CodeColoring\CodeColoring.xml" file instead of the one in my Application Data directory...

 

Syntax coloring tweaks have been really helpful; thanks for the tip guys!

Link to comment
https://forums.phpfreaks.com/topic/1822-syntax-coloring/#findComment-6550
Share on other sites

  • 3 weeks later...
I fought with this forever because I kept editing the "C:\Program Files\Macromedia\Dreamweaver MX 2004\Configuration\CodeColoring\CodeColoring.xml" file instead of the one in my Application Data directory...

So where did you find this Application Data directory? I did a search of my C drive and only found two CodeColoring.xml files. Both under C:\Program Files\Macromedia\Dreamweaver MX 2004\

 

I changed both files as "davidennis99" instructed and no luck. With the exception of:

"To change the colors:

edit->preferences->Color COding->HTML->PHP

NOT

edit->preferences->Color COding->PHP (this will just change the colors in .php-ish named files, not html files.."

Link to comment
https://forums.phpfreaks.com/topic/1822-syntax-coloring/#findComment-6658
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.