Coda PHP & Web Toolkit

  1. Download / Feedback •
  2. Help
  3. Coda Tips

AboutDownloadComments/Feedback

A Coda plugin aimed at PHP & Web development – not in active development.

Current version: 4.1 – Coda 1 and Coda 2

Features

  1. (Automatic) PHP syntax validation with jump to error and auto-save
  2. Clean up/reformat HTML, CSS, Javascript and PHP code (configurable)
  3. HTML, CSS and Javascript validation
  4. Minify Javascript and CSS
  5. Automatic check for updates
  6. It’s free (you can donate of course)

All features use the editor buffer (no need to save first) – Works with local and remote files – Written in Cocoa/ObjC.

General Preferences
Preferences for CSS
Preferences for Javascript
Validation with errors
Validation successful





Download

Download Coda PHP & Web Toolkit 4.1 »

Download Coda PHP & Web Toolkit 4.2 beta »

Sourcecode

https://bitbucket.org/mariofischer/php-web-toolkit/

Changelog »

Problems?

First have a look here » – if that doesn’t help, please write a comment below.

Enjoy using this plugin?

Great!
Just leave a comment or donate (via paypal) ».

For German users I can only recommend all-inkl.com (Partnerlink).

Planned Features

  • Apply some functions only to the selected area if desired (DONE – in the current beta)
  • Floating result windows/Growl-like notification/Use Growl (DONE – in the current beta)
  • Switch online validators more easy (DONE – in the current beta)
  • Rewrite curl methods in cocoa
  • Add configuration options for JSTidy
  • Automatically install updates
  • Use Coda 2 API for go to line (DONE – in the current beta)
  • Use Coda 2 API for automatic PHP validation before saving
  • Up next: Minify JS/CSS automatically on publishing
  • CSS minify: Check other minifier
  • Respect spaces per indent (in different cases)
  • PHP tidy: Preserve whitespaces, if possible
  • Minification: Upload .min.css or similar, if possible
  • Check new HTML5 tidy
  • Javascript execution directly via cocoa (improvement necessary)
  • Make PHP tidy more configurable (if possible)

795 Replies to “Coda PHP & Web Toolkit”

  1. I noticed that after installed, in a mixed php/html document, the search works only in the html code, and if I search for something inside the <?php tags, I cannot find it!

    1. The plugin has no connection to the search function, I assume the problem lies somewhere else.

      UPDATE: I also checked the search function – works without problems. Check the search configuration by clicking on the magnifier icon on the left, maybe you selected “Find within selection” or unchecked “Wrap around”.

  2. I really like the html tidy, very handy. It does however convert my html 5 doc into a transtional:

    anything happening on that or do we just need to keep converting them back after tidy?

  3. I think there is a bug when minifying CSS, something with a negative margin, for example… margin:0 0 0 -20px; removes the space from the dash, and it becomes margin:0 0 0-20px;

    1. Hi –

      Firefox, Safari and Chrome seem to interpret the CSS in this case correctly – even though the minus sign is missing. So I’m not exactly sure if this is a bug or just an ugly but valid formatting. Is the margin interpreted correctly in your minified CSS?

      1. I am on Chrome v.22 on Mac and it did NOT work, however I did not check other browsers, because I quickly found the minus sign fixed and just went ahead and entered the space manually.

          1. Ok, I went back to the original code. My mistake as I typed my example wrong. It looks like the below will work
            margin:0-17px 0 0;
            However, this will not work below (I guess when you have the px before the minus it does not)… That is the same snippet from my CSS.
            margin:40px-17px 0 0;

            1. I see, without “px” or just one “px” at the end it works. Nevertheless it’s a bug – is on the todo list for the next version. Thanks!

          1. I must have misunderstood something because even version 1.4 isn’t working. I just put the plug in file into the Coda folder, like every other plug in I use, but I can’t see it appearing in the plug in menu…

  4. I just installed the plugin in coda 2.04 in mac os 10.7.5. It installed fine and worked for a few hours but now all the actions are just gray and un-clickable making the plugin unworkable.
    I love the plugin and really want to continue using it.

  5. It would be nice if Tidy HTML avoided to create a line break when on empty sections. Especially in the cases where you would have the following code:

    The tidy html function will give this result:

    1. Hi –

      your HTML snippets were removed by wordpress.. Have a look at the HTML tidy documentation (see the plugin settings, HTML and the button at the bottom). There you can see all configuration settings which you can try out using the “Custom”-configuration.

  6. Hiya,
    When I try to do PHP validation or tidy I get :
    PHP returned nothing
    Make sure the file has no errors, try using UTF-8 encoding.

    1. This usually has to do with a wrong php installation. Check in the advanced preferences of the plugin if the path to php is correct. If that does not help, turn on the debug mode there and try again and send me the corresponding log messages (using console, all messages starting with “[Coda PHP Toolkit]..”

      1. Hey,
        I’ve found the problem.
        For some reason I had to do:
        sudo ln -s /usr/lib/libpq.5.3.dylib /usr/lib/libpq.5.dylib

        I think the simlink disappeared after repairing permissions.
        Quite weird.
        Thanks for your help!

  7. I’m getting:

    Notice: Undefined offset: 595 in /Users/foobar/Library/Application Support/Coda 2/Plug-ins/PhpPlugin.codaplugin/Contents/Resources/phptidy-coda.php on line 1271

    as additional Line/s on the File if I enable Brace Style Always on new line and Add blank lines in the Prefs and try to use PHP Tidy.

  8. Plugin v3.8 in Coda 2 works great except I think the “Require ‘use strict'” checkbox in the JSHint preferences is not being saved or passed along to JSHint. No matter how I set that checkbox I get a warning about missing use strict in every function.

    Idea for an upgrade: have an option to run JSHint on every save of a js file just like it’s an option to run validate on PHP files on every save. I love that validation of mny PHP code happens automatically on every save!

    1. Hi –

      I’ll have a look at the “use script”-setting.

      About the auto-validation: This should be possible, I’ll try to include it in the next update.

    2. About “use strict”: You also have to uncheck “allow global use strict”, because this setting automatically enables strict mode. This should help :)

    1. Sorry.. but my plugin just does validation/reformatting/compression of PHP. Things like autocompletion and syntax highlighting are inside Coda itself. (If you’re talking about validation that does not work with php 5.4: You can install another php version, via Macports i.e and switch to an alternate php interpreter for validation in the plugin preferences.)

  9. It seems that html tidy is inserting 4 spaces instead of tabs, is it possible to configure it to use tabs?

    Thanks for a great plugin, I hope the donation arrived!

      1. Cool, thanks for the info. I guess I can just search and replace 4 spaces for a tab after running html tidy.

        Cheers.

  10. Is there a setting so that when you run html tidy it only does it on a selection or if on a whole document it does not add tags. I am using a page with require_once (similar to a wordpress theme) for the header and footer so the html and body tags are in another file, and it keeps adding it to the file that i am working on.

  11. Is there any plans for having the plugin just tidy code? I have run into issues where it strips out things I need and adds things I don’t. I mainly want it to just fix my alignments.

    1. The plugin uses HTML tidy for validating and reformatting HTML – it’s free, open source and can be integrated quite well, but it has of course some drawbacks. As soon as I know of a better tool I’d integrate it of course. So if you know a HTML reformatting tool which is open source, free and runs without problems on a default OS X setup…

  12. I’ve long loved the Validate and then save feature for my PHP… but now I find myself also loving Coda 2’s new publish feature when I’m working between my local and staging server…

    Currently I just cmd-shift-V and then cmd-ctrl-P which isn’t SOooo bad, but for me and maybe others it’d be handy to have a single shortcut to do it all “validate, save and publish”

    1. Hi –

      I’ll have a look for the next beta if this is possible. Might only be somewhat dangerous if you forget about this feature and suddenly find yourself having published all your test code to the live platform….

      UPDATE: Unfortunately currently not possible with the Coda API.

      1. That’s a good point… and just noticed your not about it not being possible with the current API as well.

        As I make my workflow “better”, I no longer put live remote sites into Coda, I only link Coda up with my staging servers and deploy to live by other means (git mostly)… and I _always_ have a staging server (not really… but I try to).

  13. Weeeeee !
    Brilliant job Mario!
    Was looking for this desperately.
    Tried out the 3.7 beta. and have to look at it deeper.

    Keep up the good work!

    Michael.

  14. For me, this plugin only seems to work with files that are opened directly, and does not work with files opened from a “site”. The plugin still shows up, however the functions of it are greyed out.

    1. I can’t reproduce this here. Functions are greyed out only if no file is opened or the open file is empty [or has less than 5 characters]. Please try if the current beta [see above] solves this problem..

  15. Great plugin, Mario.

    Are there plans to support the /*global … */ declaration in JSHint so that you can declare what variables should be global (or inherited elsewhere) in your JavaScript?

  16. I can’t seem to get Growl notifications to work, they are enabled in the preferences pane. If I put a purposeful syntax error into the file, the notification appears within Coda 2 asking if I want to go to the line with the error, but no notification appears.

    Coda 2 is available in Growl preferences and notifications are enabled.

    Growl version is 1.4, Coda 2.0 (MAS) and PHP & Web Toolkit 3.6 (3.7 beta didn’t work, either).

    11/06/12 12:34:45.977 PM Coda 2: [Coda PHP Toolkit] Executing at path /usr/bin/php with (
    “-l”,
    “-n”,
    “–”
    )
    11/06/12 12:34:46.069 PM Coda 2: [Coda PHP Toolkit] Executing at path /Users/michael/Library/Application Support/Coda 2/Plug-ins/PhpPlugin.codaplugin/Contents/Resources/growlnotify with (
    “No PHP syntax errors”,
    “-m”,
    “File: PlanTypes_to_Products.php\nFile was automatically saved.”,
    “-n”,
    “Coda PHP & Web Toolkit”,
    “–image”,
    “/Users/michael/Library/Application Support/Coda 2/Plug-ins/PhpPlugin.codaplugin/Contents/Resources/codaphp-plugin-icon.png”
    )

    If I execute growlnotify with the parameters as above, nothing happens either.

    If I disable Growl notifications, the regular popover works. Any help you can offer would be great.

    1. Hi –

      I assume this depends on the Growl version – with the same parameters and Growl 1.2.2 [free version] it works here. As I see on the growl-homepage 1.4 doesn’t have the commandline tool growlnotify anymore but there’s a version for Growl 1.3. I’ll include this in the next update, maybe this works with 1.4.

  17. Hello, thank you for this plugin, helps keeping the code clean and compliant to a certain style :)

    I have an error to report:

    Notice: Undefined offset: 368 in /Users/johnsardine/Library/Application Support/Coda 2/Plug-ins/PhpPlugin.codaplugin/Contents/Resources/phptidy-coda.php on line 1272

    In PHP Tidy options i have “PEAR style” selected and all checkboxes selected but the “Replace shell comments”

    Thank you

      1. I don’t remember which file it was, but I found the cause (or i thought i did), it was an all php file, with no closing php ?>, i added it, the error disapeared, but im testing right now, removing the closing tag and optimizing, but it works fine, i’ll let you know if the problem occurs again and will provide more details, thanks

  18. My Favorite Coda Plugin!

    Worked great in Coda2, but now doesn’t appear in the plugin menu in Coda2.0.1.

    1. Tried it with the current 2.0.1 – without problems. Make sure the plugin was copied to [your user folder]/Library/Application Support/Coda 2/Plug-Ins/ – could be that double-clicking put it into Coda 1 oder started Coda Plugin-Creator.

      1. Looks like after the Coda2 update I needed to re-install and then restart Coda2 again. Works great now. Thanks again for the great plugin and you’re reply!

        Thanks,
        Nick

  19. I noticed a large error, that in code folding the tidy feature deletes your html that is folded.

      1. I have updated to Coda 2.0.1, but I still have issues. It seems like the tidy adds the beginning and ending tags to your html. I am working on include files that don’t need this and it gets very tedious to go and delete them every time. Any way to stop this? And I also work within XSLT sheets and when I tidy it removes things, like the / at the end of an image, this causes the page to break.

  20. Mario, looks like if an error is inside folded code, the plugin will still validate and not find the syntax errors.

    Using Coda 2 and plugin v3.6

  21. Like it, a lot.
    Frustrated at the same time.

    1. In the head I have:
    [meta name=…]
    [!–#include virtual…–]
    and HTML Tidy rewrites as:
    [meta name=…][!–#include virtual…–]
    A line break is removed.
    Very annoying

    2. After I use HTML Tidy, I have many blank lines. But, I have vertical-space: no explicitly in my custom settings.
    I don’t want these extra vertical lines.
    How do I stop this?

    3. In the body I have:
    [/div]
    [br class=”xxx”]
    and HTML Tidy removes the line break so I wind up with:
    [/div][br class=”xxx”]
    Very annoying.

    1. 1. Here I currently don’t know if this is possible with HTML tidy.

      2. If you use “indent: yes” there are no empty lines, but contents of the P-tag are indented..

      3. Use “break-before-br: yes”.

      1. #3 I added
        break-before-br: yes
        to my preferences and then I manually changed the code to:
        [/div]
        [br class=”xxx”]
        and HTML Tidy removes the line break so I wind up with:
        [/div][br class=”xxx”]
        The behavior of HTML Tidy is still the same and not as desired.

        1. With these settings it works for me:

          doctype: auto
          break-before-br: yes
          vertical-space: no
          indent: yes
          indent-spaces: 4
          tab-size: 4
          wrap: 0
          tidy-mark: no
          // Change these only if you need to debug a problem with Tidy
          force-output: yes
          quiet: yes
          show-warnings: yes

Leave a Reply to pbatts Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.