Loading ...
Sorry, an error occurred while loading the content.

The ".phtml" file extension, and the PHP filetype

Expand Messages
  • Dave Hodder
    Hello, Vim presently associates *.phtml files with PHP/FI (a.k.a. PHP 2) syntax highlighting, although realistically I doubt anybody uses it[1][2]. Instead,
    Message 1 of 9 , Nov 3, 2007
    • 0 Attachment
      Hello,

      Vim presently associates *.phtml files with PHP/FI (a.k.a. PHP 2) syntax
      highlighting, although realistically I doubt anybody uses it[1][2].
      Instead, the "php" filetype handles PHP versions 3 and above.

      Increasingly, however, I believe the ".phtml" extension is used by PHP
      5-based web applications. For example, apps based on the Zend Framework
      typically use it for the "view" part of front controller MVC.

      I have the following suggestion:

      1. Remove syntax/phtml.vim.

      2. Change *.phtml association in filetype.vim to associate with php
      filetype instead.

      3. Amend synmenu.vim so there's only one PHP menu item, just called
      "PHP". This might also be a good time to update "Cold Fusion" to
      "ColdFusion" (no space in name).

      Many Thanks,

      Dave

      [1] It was released in 1995, the same time we were all being wowed by
      Netscape Navigator 1.1! :o) PHP 3 superseded it in 1997.
      [2]
      http://www.nexen.net/chiffres_cles/phpversion/17377-php_statistics_for_july_2007.php#versions

      --
      Save the whales. Collect the whole set.

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Dave Hodder
      Out of courtesy I ve emailed Lutz Eymers (last known phtml.vim maintainer) and Peter Hodge (syntax/php.vim) with a pointer to this message. However the mail
      Message 2 of 9 , Nov 3, 2007
      • 0 Attachment
        Out of courtesy I've emailed Lutz Eymers (last known phtml.vim
        maintainer) and Peter Hodge (syntax/php.vim) with a pointer to this
        message. However the mail to Lutz failed ("mailbox disabled for this
        recipient").

        Regards,

        Dave

        --
        Save the whales. Collect the whole set.

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Bram Moolenaar
        ... I don t know about the use of PHP in .phtml files. I thought they were always called *.php. Opinions? I don t delete an existing syntax file unless it is
        Message 3 of 9 , Nov 4, 2007
        • 0 Attachment
          Dave Hodder wrote:

          > Vim presently associates *.phtml files with PHP/FI (a.k.a. PHP 2) syntax
          > highlighting, although realistically I doubt anybody uses it[1][2].
          > Instead, the "php" filetype handles PHP versions 3 and above.
          >
          > Increasingly, however, I believe the ".phtml" extension is used by PHP
          > 5-based web applications. For example, apps based on the Zend Framework
          > typically use it for the "view" part of front controller MVC.
          >
          > I have the following suggestion:
          >
          > 1. Remove syntax/phtml.vim.
          >
          > 2. Change *.phtml association in filetype.vim to associate with php
          > filetype instead.
          >
          > 3. Amend synmenu.vim so there's only one PHP menu item, just called
          > "PHP". This might also be a good time to update "Cold Fusion" to
          > "ColdFusion" (no space in name).
          >
          > Many Thanks,
          >
          > Dave
          >
          > [1] It was released in 1995, the same time we were all being wowed by
          > Netscape Navigator 1.1! :o) PHP 3 superseded it in 1997.
          > [2]
          > http://www.nexen.net/chiffres_cles/phpversion/17377-php_statistics_for_july_2007.php#versions


          I don't know about the use of PHP in .phtml files. I thought they were
          always called *.php. Opinions?

          I don't delete an existing syntax file unless it is completely useless.

          --
          hundred-and-one symptoms of being an internet addict:
          91. It's Saturday afternoon in the middle of May and you
          are on computer.

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          \\\ download, build and distribute -- http://www.A-A-P.org ///
          \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_dev" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Ilya Sher
          ... I ve seen .phtml used for php3 and php4. In addition, googling a bit revealed that the common use of .phtml _is_ for PHP. I d vote for merging .phtml with
          Message 4 of 9 , Nov 9, 2007
          • 0 Attachment
            Bram Moolenaar wrote:
            >
            > Dave Hodder wrote:
            >
            >> Vim presently associates *.phtml files with PHP/FI (a.k.a. PHP 2) syntax
            >> highlighting, although realistically I doubt anybody uses it[1][2].
            >> Instead, the "php" filetype handles PHP versions 3 and above.
            >>
            >> Increasingly, however, I believe the ".phtml" extension is used by PHP
            >> 5-based web applications. For example, apps based on the Zend Framework
            >> typically use it for the "view" part of front controller MVC.
            >>
            >> I have the following suggestion:
            >>
            >> 1. Remove syntax/phtml.vim.
            >>
            >> 2. Change *.phtml association in filetype.vim to associate with php
            >> filetype instead.
            >>
            >> 3. Amend synmenu.vim so there's only one PHP menu item, just called
            >> "PHP". This might also be a good time to update "Cold Fusion" to
            >> "ColdFusion" (no space in name).
            >>
            >> Many Thanks,
            >>
            >> Dave
            >>
            >> [1] It was released in 1995, the same time we were all being wowed by
            >> Netscape Navigator 1.1! :o) PHP 3 superseded it in 1997.
            >> [2]
            >> http://www.nexen.net/chiffres_cles/phpversion/17377-php_statistics_for_july_2007.php#versions
            >
            >
            > I don't know about the use of PHP in .phtml files. I thought they were
            > always called *.php. Opinions?

            I've seen .phtml used for php3 and php4.
            In addition, googling a bit revealed that
            the common use of .phtml _is_ for PHP.
            I'd vote for merging .phtml with .php

            >
            > I don't delete an existing syntax file unless it is completely useless.
            >


            --
            http://ilya-sher.org/

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_dev" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Dave Hodder
            ... Certainly there are web servers that do so by default, for example the Debian-packaged version of Apache httpd. Out of curiosity I downloaded the open
            Message 5 of 9 , Nov 10, 2007
            • 0 Attachment
              Ilya Sher wrote:
              >
              > I've seen .phtml used for php3 and php4.
              > In addition, googling a bit revealed that
              > the common use of .phtml _is_ for PHP.
              > I'd vote for merging .phtml with .php

              Certainly there are web servers that do so by default, for example the
              Debian-packaged version of Apache httpd. Out of curiosity I downloaded
              the open source PHPEclipse IDE, which also treats ".phtml" the same as
              ".php".

              Obviously the choice of file extension comes down to a matter of
              preference for web app developers. The ".phtml" extension _was_ to some
              degree historical, much like ".php3". However, now I believe use of
              ".phtml" for PHP 5 applications is on the rise. In order to separate
              out presentational templates from the rest of an application, people
              find there's a psychological benefit in using a different file extension
              for them.

              Thanks,

              Dave

              --
              Save the whales. Collect the whole set.

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_dev" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Dave Hodder
              ... I believe .php is the most recognised extension, but historically .phtml , .php3 and .php4 have been used as well. PHP 5.2, the current version,
              Message 6 of 9 , Nov 10, 2007
              • 0 Attachment
                Bram Moolenaar wrote:
                >
                > I don't know about the use of PHP in .phtml files. I thought they were
                > always called *.php. Opinions?
                >
                > I don't delete an existing syntax file unless it is completely useless.

                I believe ".php" is the most recognised extension, but historically
                ".phtml", ".php3" and ".php4" have been used as well. PHP 5.2, the
                current version, usually uses ".php" but ".phtml" is associated with it too.

                Vim presently has one syntax file for PHP 3 and up, and a separate one
                for PHP 2. This separation feels odd to me, the effect is that opening
                a PHP 5 ".phtml" file gives you partial highlighting. I would suggest a
                filetype.vim change from:

                " Php, php3, php4, etc.
                au BufNewFile,BufRead *.php,*.php\d setf php

                " Phtml
                au BufNewFile,BufRead *.phtml setf phtml

                ... to:

                " Php, php3, php4, etc.
                au BufNewFile,BufRead *.php,*.phtml,*.php\d setf php

                I wouldn't normally suggest deleting an existing syntax file, but I'd be
                really surprised to see anyone wanting to use it. (The last change date
                inside the file (11 May 2003) is much more recent than I'd expect, though.)

                There's a huge amount of source code for PHP 4.x applications inside
                organisations and around the Web, but I wouldn't expect to see anything
                earlier[1]. Even PHP 4 has had an official "end of life" announcement,
                with PHP 5 considered mature and PHP 6 expected in 2008.

                Thanks,

                Dave

                [1] If you look hard enough you can still find URLs ending in ".php3"
                on the WWW, but HTTP headers often vouch that they're running a
                later version of the interpreter.

                --
                Save the whales. Collect the whole set.

                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_dev" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • ixtab
                Hi, Bram informed me about the discussion, if the phtml.vim syntax file should/could be removed and ask me, being the maintainer, about my opinion. ... I think
                Message 7 of 9 , Nov 11, 2007
                • 0 Attachment
                  Hi,

                  Bram informed me about the discussion, if the phtml.vim syntax file
                  should/could be removed and ask me, being the maintainer, about my
                  opinion.

                  Dave wrote:

                  > Vim presently has one syntax file for PHP 3 and up, and a separate one
                  > for PHP 2. This separation feels odd to me, the effect is that opening
                  > a PHP 5 ".phtml" file gives you partial highlighting. I would suggest a
                  > filetype.vim change from:
                  >
                  > " Php, php3, php4, etc.
                  > au BufNewFile,BufRead *.php,*.php\d setf php
                  >
                  > " Phtml
                  > au BufNewFile,BufRead *.phtml setf phtml
                  >
                  > ... to:
                  >
                  >
                  > " Php, php3, php4, etc.
                  > au BufNewFile,BufRead *.php,*.phtml,*.php\d setf php

                  I think it's ok removing the phtml.vim syntax file. There shoud be no
                  need
                  for merging anything from the phtml to php sytax file.

                  The default extension (e.g. phtm, php or ..) should be a matter of
                  taste,
                  i would prefer keeping the file named php.vim

                  mfg

                  lutz


                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_dev" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                • Bram Moolenaar
                  ... OK, then we would drop the phtml.vim syntax file. But in case someone has :set ft=phtml we should use php syntax used for phtml. This phtml.vim syntax
                  Message 8 of 9 , Nov 11, 2007
                  • 0 Attachment
                    Lutz Eymers wrote:

                    > Bram informed me about the discussion, if the phtml.vim syntax file
                    > should/could be removed and ask me, being the maintainer, about my
                    > opinion.
                    >
                    > Dave wrote:
                    >
                    > > Vim presently has one syntax file for PHP 3 and up, and a separate one
                    > > for PHP 2. This separation feels odd to me, the effect is that opening
                    > > a PHP 5 ".phtml" file gives you partial highlighting. I would suggest a
                    > > filetype.vim change from:
                    > >
                    > > " Php, php3, php4, etc.
                    > > au BufNewFile,BufRead *.php,*.php\d setf php
                    > >
                    > > " Phtml
                    > > au BufNewFile,BufRead *.phtml setf phtml
                    > >
                    > > ... to:
                    > >
                    > >
                    > > " Php, php3, php4, etc.
                    > > au BufNewFile,BufRead *.php,*.phtml,*.php\d setf php
                    >
                    > I think it's ok removing the phtml.vim syntax file. There shoud be no
                    > need
                    > for merging anything from the phtml to php sytax file.
                    >
                    > The default extension (e.g. phtm, php or ..) should be a matter of
                    > taste, i would prefer keeping the file named php.vim

                    OK, then we would drop the phtml.vim syntax file. But in case someone
                    has ":set ft=phtml" we should use php syntax used for phtml. This
                    phtml.vim syntax file would do that:

                    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

                    " Vim syntax file
                    " PHTML used to be the filetype for PHP 2.0. Now everything is PHP.

                    if !exists("b:current_syntax")
                    runtime! syntax/php.vim
                    endif

                    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

                    If someone really wants to do something else for phtml he can create a
                    phtml.vim syntax file in his own Vim startup directory.

                    --
                    From "know your smileys":
                    :-* A big kiss!

                    /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                    /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                    \\\ download, build and distribute -- http://www.A-A-P.org ///
                    \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                    --~--~---------~--~----~------------~-------~--~----~
                    You received this message from the "vim_dev" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                    -~----------~----~----~----~------~----~------~--~---
                  • Dave Hodder
                    ... Sounds good to me. Thank you all! Dave -- Save the whales. Collect the whole set. --~--~---------~--~----~------------~-------~--~----~ You
                    Message 9 of 9 , Nov 11, 2007
                    • 0 Attachment
                      Bram Moolenaar wrote:
                      >
                      > OK, then we would drop the phtml.vim syntax file. But in case someone
                      > has ":set ft=phtml" we should use php syntax used for phtml.

                      <snip/>

                      Sounds good to me. Thank you all!

                      Dave

                      --
                      Save the whales. Collect the whole set.

                      --~--~---------~--~----~------------~-------~--~----~
                      You received this message from the "vim_dev" maillist.
                      For more information, visit http://www.vim.org/maillist.php
                      -~----------~----~----~----~------~----~------~--~---
                    Your message has been successfully submitted and would be delivered to recipients shortly.