Jump to content


Photo

Syntax Coloring


  • Please log in to reply
9 replies to this topic

#1 jonas11

jonas11
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 30 April 2004 - 06:40 PM

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


#2 morpheus.100

morpheus.100
  • Members
  • PipPipPip
  • Advanced Member
  • 145 posts

Posted 27 May 2004 - 09:41 AM

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.


#3 jonas11

jonas11
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 27 May 2004 - 03:08 PM

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.

#4 morpheus.100

morpheus.100
  • Members
  • PipPipPip
  • Advanced Member
  • 145 posts

Posted 28 May 2004 - 07:40 AM

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.

#5 masc

masc
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 03 June 2004 - 02:43 PM

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

#6 QueenOfStarwars

QueenOfStarwars
  • New Members
  • Pip
  • Newbie
  • 1 posts
  • LocationMyrtle Beach, SC

Posted 24 July 2004 - 04:16 AM

Thanks for this link! Our university also saves php files as html for MANY reasons. I'm used to how it looks with the HTML colors, but this article is great for making it easier on they eyes.

Jeannie

#7 davidennis99

davidennis99
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 17 August 2004 - 03:22 AM

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.clickaliv...odeColoring.xml

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


#8 NotQuiteJack

NotQuiteJack
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 18 October 2004 - 07:07 PM

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!

#9 morpheus.100

morpheus.100
  • Members
  • PipPipPip
  • Advanced Member
  • 145 posts

Posted 18 October 2004 - 10:11 PM

Or you could just save loads of manual editing and use the preferences panel.

#10 cyberRobot

cyberRobot
  • Moderators
  • Much to Learn
  • 2,772 posts

Posted 05 November 2004 - 07:25 PM

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.."




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users