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)

774 Replies to “Coda PHP & Web Toolkit”

  1. v.4.1 CSS minification shouldn’t quote @keyframes name.

    Source:
    @keyframes rot45 {
    from {transform:rotate(0);}
    to {transform:rotate(45deg);}
    }

    Becomes minified:
    @keyframes “rot45″{from{transform:rotate(0);}to{transform:rotate(45deg);}}

    This ruins css animation.

    Hotfix is a regexp replace
    from
    keyframes\ \”([a-z-]+)\”
    to
    keyframes \1
    in the minified css.

  2. Trying to figure out how to remove ’empty’ line spaces for HTML tidy. Can this be done? I went and found the plugin but not sure where in the contents folder to modify.

  3. Maybe this is a feature and I’m missing it:
    Is there a simple way to select a block of code/text and enclose it with

    Am I just that bad at Coda 2?

    Your plugins are amazing.

  4. Hello, it very nice plugin. good job. I’m using Symfony2 and I want to know if it is possible to configure and tidy html.twig tags. because till now when i try to tidy html, that break or remove tags and Blocks.

    I think also i will be nice if your plugin can become open source, and by this way people can contribute for it developpement.

    thanks

    1. I noticed that when I ran HTML –> Tidy HTML it deleted all of my icon elements (i) in HTML. For example, was deleted, had about 5 i elements that were missing. Thanks for your hard work!

      1. You can use the 4.2beta and select the html5 tidy in the preferences – then i-tags shouldn’t be removed anymore. (In the prior version of html tidy you should use em-tags instead).

  5. Hi, I have upgraded to the new Growl (V2.1.3) from the AppStore and tried to used it the Coda PHP & Web Toolkit (V4.1).

    Unfortunately, it doesn’t seem to find Growl and continues to use the standard notification dialogs.

    I use auto-checking when saving JavaScript files and the problem I have with the standard dialogs is that they don’t disappear by themselves. Instead of going away after a while or when a new notification comes, they just pile onto each other and after a days work I have several hundred notifications visible.

    So the question is now, how can I activate Growl?

    1. Usually you just check “Notify via Growl” on the General section of the plugin preferences, but it might be incompatible with the new Growl version.
      First thing: Try the latest 4.2 beta version of the plugin.

      The “everything fine” dialogs should disappear by themselves, just tested it – but in case of problems the error messages (of course) don’t disappear by themselves. So in my opinion this behaviour is correct, which behaviour would you expect in case of errors?

      1. Thanks for you quick reply!

        I’ve tried the beta, but there the standard notification are also used, regardless of the “Notify via Growl” setting.

        In case of an new error I would expect that any previous notifications should be closed. The way it is now, all previous notification stay open, but their contents is gone. This doesn’t seem to make sense.

        Another thing I noticed: when saving multiple files with Command-Option-S, I wouldn’t be able to find out which file created error messages, because the filename doesn’t show in the notification.

        1. The filename is a good idea for the error window, noted.

          Now I see your problem, the “old” dialogs just hang around and are empty – yes that’s a bug. Is on the list, thx!

  6. Hi – Love the plugin and it saves me heaps of time!

    One annoying aspect I find is that when using the tidy functions there is no option to use tabs instead of spaces.
    I love the tidy functions and it is one of the main things I use this plugin for, but I have to do a find/replace to get all my tabs back in there.

      1. Hi –

        this feature is with the currently included html tidy not possible (from the documentation: “Tidy never outputs tabs.”), but it might be there’s a new html5-tidy which supports this feature. I’ll have a look.

  7. really don’t know if this will solve my problem
    my script no longer installs becasue of updated php version, can i get your direct email so that i can send screen shots and the small script.

  8. Is there a way to insert a space after the CSS attribute? ie. format it this way:

    body {
    font-size: 14px;
    }

    …instead of…

    body {
    font-size:14px;
    }

    1. Hi –

      that’s on my todo-list but it might take some time until I find the time for an update. If you know PHP you can modify the file “csstidy.php” yourself (if you right click on (your home folder)/Library/Application Support/Coda 2/Plug-Ins/PhpPlugin.codaplugin, choose “show contents” and go to “Contents/Resources”). Starting from line 642 are the rules for the CSS-Tidy modes.

      Note that your changes will be overwritten with the next update – but then this is hopefully already integrated :)

  9. Hi, I have a feeling something is goofy with my setup, when I try to use HTML tidy I get a dialog telling me Coda 2 quit unexpectedly (although it doesn’t actually quit), then a dialog telling me “Tidy returned nothing”

    Any help is appreciated :-)

    Tom

    1. Hi –

      it seems the tidy executable makes problems. As first idea please try “Use HTML5 compatible Tidy” in the settings (or disabled it, if it was already enabled). If that doesn’t help: Which Mac and which OS X version do you have?

  10. It should be handy to not remove css comments on wordpress because it is used by the CMS for internal use.

    Also minify on upload for html and php would be awesome since firefox is messing up with spaces between divs

  11. This wonderful plugin has change my life.
    I love the tidy and minify for code.
    Many many thanks for plugin development and great supporting.

  12. Hi,

    This is a great plugin for Coda! I have a question with HTML tidy.

    I’m trying to tidy a section of HTML which is used as a template. It doesn’t need tags. However, the plugin kept adding all these tags which is quite annoying. I have read the whole option reference and can’t find one option which can turn it off.

    Pls advise if it is possible to turn the “Automatic HTML Head Adding” off.

    Thanks!

  13. Hi,

    I’m having a minor issue with the plugin, maybe a bug?

    All the commands work except for “Tidy HTML”.

    It pumps out an error in Coda:-
    NSInvalidArgumentException
    Error: launch path not accessible

    Console Log:
    20/1/14 3:46:44.424 pm Coda 2[939]: Exception occurred: 0 ExceptionHandling 0x00007fff88958aee NSExceptionHandlerExceptionRaiser + 172
    1 libobjc.A.dylib 0x00007fff8836ae75 objc_exception_throw + 43
    2 CoreFoundation 0x00007fff8429f2cc +[NSException raise:format:] + 204
    3 Foundation 0x00007fff8c5a8777 -[NSConcreteTask launchWithDictionary:] + 450
    4 PhpPlugin 0x0000000114bc8462 -[CwPhpPlugin filterTextInput:with:options:encoding:useStdout:] + 705
    5 PhpPlugin 0x0000000114bc7eab -[CwPhpPlugin reformatWith:arguments:called:] + 119
    6 PhpPlugin 0x0000000114bc5434 -[CwPhpPlugin doTidyHtml] + 345
    7 AppKit 0x00007fff898743d0 -[NSApplication sendAction:to:from:] + 327
    8 AppKit 0x00007fff8988f348 -[NSMenuItem _corePerformAction] + 394
    9 AppKit 0x00007fff8988f084 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 117
    10 AppKit 0x00007fff898de4dd -[NSMenu _internalPerformActionForItemAtIndex:] + 35
    11 AppKit 0x00007fff898de359 -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 104
    12 AppKit 0x00007fff89885176 NSSLMMenuEventHandler + 716
    13 HIToolbox 0x00007fff8c7206d4 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 892
    14 HIToolbox 0x00007fff8c71fc87 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 385
    15 HIToolbox 0x00007fff8c733d90 SendEventToEventTarget + 40
    16 HIToolbox 0x00007fff8c769a30 _ZL18SendHICommandEventjPK9HICommandjjhPKvP20OpaqueEventTargetRefS5_PP14OpaqueEventRef + 420
    17 HIToolbox 0x00007fff8c79c618 SendMenuCommandWithContextAndModifiers + 59
    18 HIToolbox 0x00007fff8c79c5c4 SendMenuItemSelectedEvent + 178
    19 HIToolbox 0x00007fff8c79c4a5 _ZL19FinishMenuSelectionP13SelectionDataP10MenuResultS2_ + 94
    20 HIToolbox 0x00007fff8c7a4425 _ZL14MenuSelectCoreP8MenuData5PointdjPP13OpaqueMenuRefPt + 718
    21 HIToolbox 0x00007fff8c7a4051 _HandleMenuSelection2 + 446
    22 AppKit 0x00007fff897f779c _NSHandleCarbonMenuEvent + 284
    23 AppKit 0x00007fff8965656e _DPSNextEvent + 2170
    24 AppKit 0x00007fff896558db -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
    25 AppKit 0x00007fff896499cc -[NSApplication run] + 553
    26 AppKit 0x00007fff89634803 NSApplicationMain + 940
    27 Coda 2 0x0000000100002a04 start + 52
    28 ??? 0x0000000000000001 0x0 + 1

  14. The JS Minify function is putting a lot of things in new line. Is there any option or way it could puts everything in one line? The way actual minify should work?

    Also, is there a way to maintain a file.min.js for the minified version (published version) and file.js for development. This is the way I think it should be… Don’t you think?

    1. Hi –

      the JSMin implementation is not very flexible. It’s a port of the Douglas Crockford JS Minify, but maybe there are better solutions now. For the next version I’ll have a look.

      About the .js/.min.js: Of course this would be the best practice. Currently you can keep the .js-version locally and publish the minified version automatically (see plugin settings). If I find some time I might include another option to automatically save a “*.min.js”-file next to the original file.

      1. Thanks for the reply brother. I found that the YUI Compress plugin for Coda does this (saves a .min.js). Maybe you can look into that in next versions of the plugin :)

  15. This is what I was looking for a long time ago. Only one question. Is it possible to have a tab indent code format instant of a 4 space indent?

    1. Chances are quite good :) I suppose in the next days I’ll find the time to update JSHint and the plugin. Have a look at the beta version above!

  16. Thanks for the plugin however there are still some annoying issues such as:
    1. Why HTML head and body tags added each time I want to Tidy-up only a body code? I know I can use the “body only (experimental), but it’s still experimental and deletes other code parts such as PHP includes outside of the HTML tags.
    2. Input tags such as Label, Textarea and Inputs are Tidy-up funny. Textarea breaks in the middle if you use a placeholder, the closing tag indents to the far left not under the opening tag.
    3. Label and input tags follow each other rather then wrap as separate tags.
    Thanks,

    1. The thing is I use HTML tidy and can’t simply add features or modify its inner workings. You can play around with the settings (see documentation on the plugin settings page), that should help.

      About “body only”: I’ll remove that “experimental” tag :) But php-statements should be left in the code, at least if you use the complete form for php-tags (that is: ?php … ?, with the brackets of course).

      1. Thanks for the quick reply.

        Almost all front-end code is build on includes and parts not full HTML pages with body and head tags. having those added each time I try to tidy part of my code is annoying and time consuming.
        Cheers

        1. Of course, same goes for most complex web projects.
          HTML tidy is good for validating complete HTML pages but for HTML snippets it’s surely not the best. As soon as I know of a better tool for this purpose I’d be glad to include it if possible…

  17. Hi there,

    I have PHP & Web Toolkit for Coda 2 and lately I’ve noticed that the CSS Minify and CSS Tidy features are resulting on the same thing (minified CSS).

    Are you aware of this issue? Any help or solutions for this?

    Thanks anyway ;)

    1. That depends on the CSS tidy configuration in the plugin settings. If you choose “highest compression” it is quite the same, but not for the other settings..

    2. I can confirm that the HTML Tidy option, using the Body Only configuration does all kinds of different things to embeded php tags. Some it throws away completely, some it converts to <?php and some it leaves alone.

      Is there a configuration option (Custom, perhaps?) that simply indents the HTML nicely and doesn’t add, change or delete anything?

  18. Hi there, thanks for this useful coda plugin!

    I got an issue with the HTML tidy function: i set up for the BODY ONLY tidy mode and aN HTML tag like this “i” “/i” disappear after the script command. I flagged HTML5 compatible compatible tidy but unfortunately nothing is changed.

    Have you any suggestion to fix it?

    Thanks in advance for your response.

    1. Hi –

      the “i”-tag (just don’t use the brackets to show tags here) is deprecated therefore considered invalid. Use “em” “/em” instead.

  19. I really wish the Tidy HTML command would put comments on a separate line. This plugin would be perfect if it did. As it is now, I have to go back in and move all my comments. Is there a setting I’m missing?

  20. Hi, thanks for a great plugin. I do have a problem using PHP tidy code, on just a selection. It works great if I do not tick selection. Then it does the whole file. But when I tick to just apply to selection, nothing happens when I try to use it. It does say that it worked, but it doesn’t. Tried from both top menu and right-click menu. Advice?

  21. Great plugin, I have the problem where bootstrap / font-awesome / icomoon etc all use empty tags as placeholders for icons / glyphs, and can’t find a setting that leaves them alone (custom doesn’t seem to have that option). Anything you could do to help exclude certain empty tags (or tags that are empty but have an attribute) in a future version would be appreciated!

    1. You could try to use “new-empty-tags” as custom config option, but I’m not sure if the included version of HTML Tidy already supports this option – but in the future I’ll surely update HTML tidy so that new-empty-tags will be supported.

        1. In the custom configuration you can add a list of tags which can be empty by default, like this:

          new-empty-tags: test,address

          This is included in the HTML 5 compatible tidy but according to the issue tracker on Github it doesn’t work realiably. Probably the next weeks I’ll put another version online with an updated version of tidy

  22. It would be nice to have a php version option so that specific php language features can be tested, for example, the short array syntax “[]” in php 5.4.

    I would also be nice if the plugin supported the short array syntax.

    1. Hi –

      the plugin calls the installed php interpreter to check the syntax, so if you have php 5.4 installed (via MacPorts for example) you can set the php binary to use in the plugin options (like /opt/local/bin/php i.e.).

Leave a 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.