4 Replies Latest reply on May 30, 2010 8:38 AM by ciro.mar@tin.it

    Implements php function in dreamweaver cs4 / cs5

    ciro.mar@tin.it Level 1

      Hi,
      I made a framwork for my company that develops using php.
      It would be nice to not always having to explain the use of functions, implement dreamweaver, possibly through an extension, the intellisense for these functions.

      for example when using the shell function require me indicates that the function accepts a string. in the case of mysql_connect are advised to enter the host name etc..

      It would be very important to implement something like this for my functions

      is it possible?

        • 1. Re: Implements php function in dreamweaver cs4 / cs5
          Randy Edmunds Adobe Employee

          I made a framwork for my company that develops using php.
          It would be nice to not always having to explain the use of functions, implement dreamweaver, possibly through an extension, the intellisense for these functions.

          for example when using the shell function require me indicates that the function accepts a string. in the case of mysql_connect are advised to enter the host name etc..

          It would be very important to implement something like this for my functions

          is it possible?

           

          Yes, it's possible.

           

          For CS4, you'll have to write some XML for the intellisense. Take a look in the Configuration/CodeHints/ folder for examples.

           

          Starting in CS5, you'll automatically get intellisense for PHP. Also new in CS5, you can write XML to get additional information displayed below the vode hints list. I'm not exactly sure how that's done, and the CS5 Extensibility Docs haven't been released yet, so look in the CodeHints folder to see if you can figure it out.

           

          Regards,


          Randy Edmunds

          Dreamweaver Development

          Adobe Systems, Inc.

          • 2. Re: Implements php function in dreamweaver cs4 / cs5
            ciro.mar@tin.it Level 1

            thanks for the reply.

            I analyzed the file codeHints on php but I can not get what I want. I am doing tests on cs5 version.

            I inserted the following code in the file

            [Code]
            <Function pattern = "today (string $eng)" doctypes = "PHP_MySQL" displayrestriction = "PHP_Script" icon = "shared / mm / images / hintFunction.png" casesensitive = "true" MMString: source = "php / CORE" description = "@ # php_CORE3.xml mysql_connect" />
            [/ Code]

             

            in new php file i put

             

            function today($a).......

             

            when i type today(...

             

            the intellisense show me $a not 'string $eng'....

             

            the problem may be caused by

             

            MMString: source = "php / CORE" description = "@ # php_CORE3.xml mysql_connect"

             

            ?

             

            I do not think because from what I understand this is the explanation of function and not the intellisense

             

            thanks a lot in anycase

             

            Ciro Marotta


            • 3. Re: Implements php function in dreamweaver cs4 / cs5
              Virgil Palanciuc

              Hello Ciro,

               

              I'm not sure I understand all the issues you're having, but I'll try to reply... ask again if you have more questions.

               

              If you want to offer codehints for your own framework, the best thing is to simply use the "site-specific codehints"  tool. You can create a "preset" with your framework, which can then be exported & imported by other users. For most of the usecases, I think this should be probably all that you need to do.

              Now, there are cases where the default engine might not recognize all the hints that you want to offer (e.g.  you have global variables defined using extract() ); it is still possible to add those hints, but it's somewhat more complicated, ask again if you need help (as a starting point - you can look at the "Drupal" presed for codehints, it references a file in your "user configuration" directory). BTW, the "builtin" CMS codehinting presets are defined in [Config folder]/Shared/Dinamico/Presets - look there how Drupal is described, and you can easily make a similar description for your own framework (and install it as an extension together with other support files if needed).

               

              Now - if you wish to add description tooltips for your hints (like those for the builtin php hints) - this is again possible, but, unfortunately, not so easy as it could've been (*). However, if you wish to add those , it's entirely feasible: just look at the way the  builtin hints are defined (basically, you need to prefix your function/class/ class member/ variable/etc.  with a comment that says something like "/** @file_name.xml#description_tag */; the "file_name.xml" is located in the folder CodeHints/Descriptions, if I'm not wrong - look there for how the tooltips are described; it's basically a list of key-value  pairs, with the "key" being the "description_tag", and the value is the (escaped) HTML content of your tooltip).  Unfortunately I don't have access to a Dreamweaver installation right now so I can't tell you for sure, but if you can't handle it ask again and I'll give more details tomorrow.

               

              Finally, about the "today" function: as I understand it, your framework redefines a builtin PHP function - and you'd like the codehint to change, too? I can't tell for sure that it will work, without trying... but if you add in the "site-specific codehints" a file that contains your definition of "today", it might override the builtin. If it doesn't work (and in fact, I'm afraid that it won't work) - then your only options are (A) disable the builtin "mysql" hints from the options, or (B) manually (or through an extension) rewrite the file that  declares the hints for "today"  so that you remove that function.

               

                 Hope that helps,

                     Virgil.

               

              (*) PS: This functionality (description tooltips) is in fact intended to be used by Dreamweaver internally - so I doubt it will be documented. We initially wanted to show the user's PHPdoc comments as "descrition tooltips"... but it is surprising how many complications appear (formatting issues for HTML vs. non-HTML comments, in-comments javascript,  etc.) - so eventually we ran out of time and decided to keep it "for DW's internal use only". Who knows, maybe it will work in a more "user-friendly" way in future DW versions

              • 4. Re: Implements php function in dreamweaver cs4 / cs5
                ciro.mar@tin.it Level 1

                Hello Virgil,
                thanks for the reply and sorry if I have not been replicated. I was too busy with work.

                The use of "specific suggestions for the site" meets my requirements.

                Therefore I solved the problem.

                For more complicated things return to a later stage where I am less busy.


                Thanks again.

                Ciro Marotta