20 Replies Latest reply: Oct 16, 2012 4:52 PM by CJJ9 RSS

    code color php in htm and html documents

    helennewton Community Member

      Hi, my web is 10 years old and most pages have the extension of .htm

      However they have php code, and I have a rule in the server to serve my html pages as php.

      I just tried dreamweaver cs5 and I can see that there are no way to get the php code in the htm pages colored...

      the php code is all blue.

      I checked in preferences to change the code coloring for html pages, however there are no php option.

      Only in .php pages the php code is colored.

      Can this be arranged?

      If not, this is very bad thing as many old sites uses the html extension for php pages.

      Thanks in advance.

      Helen

        • 1. Re: code color php in htm and html documents
          MurraySummers CommunityMVP

          If not, this is very bad thing as many old sites uses the html extension for php pages.

           

          I would take issue with your use of the word "many", but I guess it's arguable at worst. I know that I have an ASP site that is set this way....

           

          There is a way to make DW color code html files containing PHP - for the life of me I can't remember how.  Why do you not want to 'come out' as it were, and just change your filenames over to a PHP extension?  Are you hosted on Windows?

          • 2. Re: code color php in htm and html documents
            helennewton Community Member

            Thanks, but,

            To change the extension of the pages that been on first page in google, I prefer to use my old version of dreamweaver.

            I found a way doing changes in a file, however it did not work.

            Of course many persons do html pages and later they learn php and add php code to the html pages,

            not only old websites has html pages,

            cant understand why adobe did such a downgrade. The old version I used colored php in html pages.

            • 3. Re: code color php in htm and html documents
              John Waller CommunityMVP

              Try

              http://kb2.adobe.com/cps/164/tn_16410.html

               

              cant understand why adobe did such a downgrade. The old version I used colored php in html pages.

               

              There has been no upgrade or downgrade in this functionality. No change at all.

               

              If your older version used to code color PHP in HTML doucments then it must have been tweaked manually to do so at some point.

              • 4. Re: code color php in htm and html documents
                helennewton Community Member

                Thanks, will try that one, already tried 2 that did not work,

                Nop, I install and reinstall my dreamweaver without doing any changes at all,

                the php code is being colored by default in html pages.

                btw, its old, I use dreamweaver mx2004.

                • 5. Re: code color php in htm and html documents
                  John Waller CommunityMVP

                  Works here. CS5.

                   

                  I used to use MX 2004 too and it never colored PHP code in HTM/HTML files on a fresh install.

                   

                  Glad it works for you on that version though but I'm sure that feature wasn't there by design.

                  • 6. Re: code color php in htm and html documents
                    helennewton Community Member

                    Lol, Must been some problems with your pc, since 2004 I had several computers,

                    and formatted many times, used diferent windows, and it always colored my php code.

                    Later I will try and let you know if I manage to get it to work.

                    However I do think this should be an option.

                    • 7. Re: code color php in htm and html documents
                      MurraySummers CommunityMVP

                      To change the extension of the pages that been on first page in google, I prefer to use my old version of dreamweaver.

                       

                      This is the simplest thing in the world if you are hosted on a *nix server.  Just use an .htaccess file to do a 301 redirect of oldname to newname.  No SEO penalty at all when it's a 30x redirect.  Look at the flexibility you'll gain by doing that!

                      • 8. Re: code color php in htm and html documents
                        MurraySummers CommunityMVP

                        I used MX2004 too, and don't recall it doing that either. 

                        • 9. Re: code color php in htm and html documents
                          helennewton Community Member

                          lol and lol again,

                          I have it installed at this moment and yes it do color php files, I ever touched any files,

                          you must speak about another version,

                          if you want I can send it to you and you can see for yourself that it does.

                           

                          No I dont want to change any name of any page that existed for many years,

                          and people know there name,

                          a more than 500 pages site in several languages,

                          and hundreds of pages are well indexed,

                          it is just perfect with the host serving the pages as php.

                          • 10. Re: code color php in htm and html documents
                            John Waller CommunityMVP

                            No I dont want to change any name of any page that existed for many years,

                            and people know there name,

                            a more than 500 pages site in several languages,

                            and hundreds of pages are well indexed,

                            it is just perfect with the host serving the pages as php.


                            No need for any issues there if you set up a 301 redirect via a .htaccess file.

                            • 11. Re: code color php in htm and html documents
                              helennewton Community Member


                              Thanks, but I now that perfectly well, I took the decision years ago to dont do a 301,

                              I tell the server to read the html as php, as I think that is better, I dont want to change name of any

                              of my 500 pages, its just rediculous. No need to.

                               

                              Dont know what I am doing wrong, I followed the instructions and it doesnt work, before

                              I got an error but that was because I saved the backup copy in the same folder.

                              Lets see if I think wright, I have to do change in extensions.text and in MMDocumentTypes.xml.

                              But should I delete the hmtl from html and add to php, or delet the php and add to html?

                              I tried both and non worked, maybe I have to restart. will restart and see if any changes dones.

                               

                              Btw, I did a research on google, and there where many asking the same thing, Im not the only one,

                              should be an option.

                              • 12. Re: code color php in htm and html documents
                                mytaxsite.co.uk CommunityMVP

                                I have put the following code in my conf file:

                                 

                                <IfModule dir_module>
                                    DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
                                                   default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
                                                   home.php home.pl home.cgi home.asp home.shtml home.html home.htm
                                </IfModule>

                                 

                                This ensures that no matter what the file extension is, my server will render the file.  Perhaps this is not what you are looking for.  Also, the configuration file is only relevant if you are running your own server.  you can't change your host's files!!!

                                 

                                hth

                                • 13. Re: code color php in htm and html documents
                                  Keith.L Community Member

                                  Hi, I was also looking for a solution for the coloring codes problem and found this post.

                                  I tried that link you provided, I tested all kind of ways, putting all into html, putting all into php, puttting all into both.

                                  I restarted dreamweaver and its just the same....I do change the files that are in program files just as it says in the link and I do use notepad to do the change.

                                  dont know if I doing anything wrong, anyway that link only talk about versions cs3 and lower, I have cs5, so maybe it wont work on cs5.

                                  Thanks,

                                  Keith

                                  • 14. Re: code color php in htm and html documents
                                    Keith.L Community Member

                                    After hours researching both internet and my own pc,  found another file with the same name that is the one that should be changed, this link I found in this forum:

                                    http://kb2.adobe.com/cps/164/tn_16410.html this link does not concern cs5 at all.

                                     

                                    To change the code color in cs5, you must change the MMDocumentTypes.xml file not found in programfiles as per that link, but the one that can be found in documents and settings/etc, changing the one in program files wont do absolutely nothing.

                                     

                                    And I must agree with Helennewton, I think its a downgrade you cant color all kinds of codes in an html file,

                                    its a handicap. (well you can do, however not easily).

                                     

                                    And just to change filetype not domain name, the practice is to put a code in .htaccess file to read html files as whatever you want, not to do a 301

                                    redirect that is more indicated when the page changed domain or name, not just extension.

                                     

                                    Hope this will help more with the same problem,

                                    would not be a bad idea to update that link with the correct information for cs5.

                                    • 15. Re: code color php in htm and html documents
                                      Lon Winters Community Member

                                      Well, there's one thing I learned from this discussion. I've often wondered how HTML files were able to run script, such as log ins. Now I know! Generally speaking though, wouldn't this practice be considered deprecated? If so, and while I do understand the issue and logic of the problem, I feel that any solution shold move away from deprecated methods, in general of course.

                                      • 16. Re: code color php in htm and html documents
                                        MurraySummers CommunityMVP

                                        wouldn't this practice be considered deprecated?

                                         

                                        I don't think you could call it deprecated, and in some cases it may be the only solution.  But it will certainly cause a successor to scratch their head a bit at first.

                                        • 17. Re: code color php in htm and html documents
                                          MurraySummers CommunityMVP

                                          I've often wondered how HTML files were able to run script, such as log ins.

                                           

                                          Often times, they aren't.  The HTML page is likely submitting the data to a server-scripted process page which returns to the login page if authentication fails.

                                          • 18. Re: code color php in htm and html documents
                                            Keith.L Community Member

                                            Murray *ACP* wrote:

                                             

                                            I've often wondered how HTML files were able to run script, such as log ins.

                                             

                                            Often times, they aren't.  The HTML page is likely submitting the data to a server-scripted process page which returns to the login page if authentication fails.

                                             

                                             

                                            Just dont understand that, if you write in your htaccess file your html files are asp or php pages, they works just like if they were called .asp or .php

                                            There is absolutely no difference.

                                             

                                            If you add this to your htaccess:

                                            AddType application/x-httpd-php html

                                            all your pages named html will function as if they were php pages.

                                             

                                            You can do whatever you want using php, as for exampel login. If you cant code for yourself,

                                            well maybe the host have some loginscript for you.

                                            • 19. Re: code color php in htm and html documents
                                              helennewton Community Member

                                              Keith.L wrote:

                                               

                                              After hours researching both internet and my own pc,  found another file with the same name that is the one that should be changed, this link I found in this forum:

                                              http://kb2.adobe.com/cps/164/tn_16410.html this link does not concern cs5 at all.

                                               

                                              To change the code color in cs5, you must change the MMDocumentTypes.xml file not found in programfiles as per that link, but the one that can be found in documents and settings/etc, changing the one in program files wont do absolutely nothing.

                                               

                                              And I must agree with Helennewton, I think its a downgrade you cant color all kinds of codes in an html file,

                                              its a handicap. (well you can do, however not easily).

                                               

                                              And just to change filetype not domain name, the practice is to put a code in .htaccess file to read html files as whatever you want, not to do a 301

                                              redirect that is more indicated when the page changed domain or name, not just extension.

                                               

                                              Hope this will help more with the same problem,

                                              would not be a bad idea to update that link with the correct information for cs5.

                                               

                                              Thanks Keith,

                                              Finally I found the file you are talking about, and it works perfect, thanks a lot.

                                              You must not save a copy of the file in the same folder just as they say in the link, if you do you get error. So if you do a backup of the file before editing it, save it somewhere else.

                                              And its not in programfiles as the link says, (as Keith found out) In my pc it was in documents and settings/administrator/ (In programfiles there is another with the same name)

                                              • 20. Re: code color php in htm and html documents
                                                CJJ9 Community Member

                                                I'm Korean. And ... not good at English ^^ sorry.

                                                 

                                                My environment is : Win7, DreamweaverCS5

                                                 

                                                 

                                                1. Exit dreamweaver

                                                 

                                                2. Kill the process named "CS5.5ServiceManager.exe" in the task manager. (VERY IMPORTANT)

                                                 

                                                    If you miss this step, you will receive many error messages when start DW.

                                                    And the changes in configuration is not work correctly.

                                                 

                                                3. Remove directory "C:\Users\cjjo\AppData\Roaming\Adobe\Dreamweaver CS5.5", if it exists.(VERY IMPORTANT)

                                                 

                                                4. Modify "(DWCS5 Install directory)\configuration\Extentions.txt"

                                                 

                                                    move the 'HTML' on line 2 in ':HTML Documents' to ':PHP Files'.

                                                           ... like this ...

                                                          HTM,HTA,HTC,XHTML:HTML Documents

                                                          ... skip lines ...

                                                          PHP,PHP3,PHP4,PHP5,TPL,PHP-DIST,PHTML,HTML:PHP Files

                                                 

                                                    Save and close.

                                                 

                                                5. Modify  "(DWCS5 Install directory)\configuration\DocumentTypes\MMDocumentTypes.xml"

                                                 

                                                    1) find '<documenttype id="HTML"', and remove 'html' in 'winfileextension=' and 'macfileextension='.

                                                          => <documenttype id="HTML" internaltype="HTML" winfileextension="htm,shtml,shtm,stm,tpl,lasso,xhtml"

                                                                macfileextension="htm,shtml,shtm,tpl,lasso,xhtml,ssi" file="Default.html" writebyteordermark="false" mimetype="text/html">

                                                    2) find 'id="PHP_MySQL"', and add 'html' in that section's two list.

                                                         => <documenttype id="PHP_MySQL" servermodel="PHP MySQL" internaltype="Dynamic"

                                                               winfileextension="php,php3,php4,php5,phtml,html" macfileextension="php,php3,php4,php5,phtml,html" file="Default.php"

                                                               writebyteordermark="false" mimetype="text/html">

                                                 

                                                     Save and close.

                                                 

                                                6. Start DW.

                                                 

                                                =============

                                                 

                                                All instructions I found in the web, they only explain that how to change the configuration.

                                                And they didn't work. So, I spent much time to find correct way.

                                                 

                                                The important thing is that => step 2 and 3

                                                 

                                                Thanks~ Good luck

                                                Oh my poor Eng. T.T