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)

790 Replies to “Coda PHP & Web Toolkit”

  1. The new JS Hint is being a pain by telling me to add “use strict” at the top of every function. The preference ‘Require “use strict”‘ is not checked. How can I get it to stop seeing this as an error?

      1. Hi Mario,
        There are no boxes checked in the JS Hint section. I don’t want to use strict mode, and haven’t put “use strict” anywhere in the code.

        1. I see – my test file was too simple…

          The problem is that the the plugin calls the new version with some (until now reasonable) defaults, one of them is “Allow node.js”. But this setting seems to have changed (or have a bug) so the “Use strict” warning is shown.

          Is fixed for the next update.

  2. I’m using Coda v. 1.7.5 with Mac OS 10.5.8. I’ve downloaded the latest version of Coda PHP & Web Toolkit, installed, restarted Coda (and my computer) but it’s just not showing up in the Coda Plug-ins drop-down menu. I’ve gone through all of your recommendations above. Is this a problem you’re familiar with?

    1. Please open “Console” (in Applications/Utilities), start Coda again and send me the relevant lines (starting with “Coda..”) to my email (mario at chipwreck.de), thx!

      The plugin requires OSX 10.6 or higher.

  3. I am trying to modify the html tidy so that it doesn’t make ‘s have a double space between each line. Any way to do this?

      1. Oh why yes it did! The double space inbetween the lines of an unordered list (it removed the LI from my post)

        1. You can try the preset “very indented” in the plugin preferences or choose the custom settings I posted for another comment above.

  4. Hey
    I just noticed a bug with “Tidy CSS”.

    The line
    @import url(‘../thematic/library/styles/reset.css’);
    get’s replaced with
    @import “url(../thematic/library/styles/reset.css)”;
    And like this it just doesn’t work anymore.

    It seems to be a bug in this plugin as the online version of TidyCSS doesn’t change that line: http://cdburnerxp.se/cssparse/css_optimiser.php

    Anyway thanks for this great plugin! :)

    1. Don’t know which CSSTidy version this website uses but probably an other one – since my plugin doesn’t modify the behavior of CSSTidy and quotes. But since the version I included is the latest version it might be that there’s a bug or setting which I didn’t realize.

      I’ll have look.

      UPDATE: Included a workaround for the next update.

          1. Seems to be a bug in that version of CSSTidy. But as I noticed you already reported it. :)

  5. One thing I noticed and this is affecting another plugin I use. When validating HTML and have code collapsed it doesnt seem to register that content while validating.

    1. Yes, that’s a bug in the Coda 2 API – I already reported it to Panic and I assume it will be fixed in the next Coda 2 update.

    1. For the first issue select “body only” as html tidy style in the plugin preferences.

      The second issue seems like the plugin might be installed twice (see #3 here – or it’s a bug in Coda 2.

        1. Yes, that’s the drawback of HTML tidy – which is more suited for formatting/validating complete HTML files than for indenting code blocks.

          If I find another (open source/free) solution which can be integrated, I’ll of course do it.

  6. Hello!
    First I’d like to say: This is the best plugin for Coda ever!

    Now to my question: Is there a possibility to change the CSS-Tidy option, where the last semicolon gets deleted.

    * {
    -moz-box-sizing:border-box;
    -webkit-box-sizing:border-box;
    box-sizing:border-box
    }

    thank you ind advance

    1. You can change this manually:

      – Go to (your user folder)/Library/Application Support/Coda/Plug-Ins/
      – Right click on “PhpPlugin.codaplugin” and select “Show Contents”
      – Open the file “Contents/Resources/csstidy.php”
      – Change true to false on line 2128: $this->settings['remove_last_;'] = true;

      Please note that this modification will be overwritten as soon as the next plugin is installed (so you have to do it again..). More options for CSStidy would be a nice idea, but currently I don’t have enough time to implement this also. Is on the todo list..

  7. Mario, feedback on a possible bug (using 3.5beta2 on Coda 2).

    PHP validation is not calling a syntax error in function arguments, like this:

    function mchammer($cant, $touch; $this) {
    etc
    }

    That semicolon after $touch does not trigger invalid syntax.
    Just wanted to let you know.

    1. Works correctly here. I have tried this file and the latest beta reports correctly “Parse error: parse error, expecting `’)” in – on line 2″..:

      1. mario i was using 3.5beta — now I installed beta2 and you’re right, it triggers the error – thanks

  8. Thanks for this excellent plugin, I’ve been using in Coda1 for ages, and was impressed with your turnaround for Coda2.

    One issue I have noticed is that the Javascript tidy feature doesn’t respect line ending semicolons as being optional.
    I tend to use a mixture (usually omit semicolons console.log debugging), however with the plugin doing a tidy on the code causes the next line to append to the previous one if no semicolon was used.

    eg

    var foo = ‘bar’;
    console.log(foo)
    if (foo == 3) {
    console.log(‘baz’)
    }

    becomes

    var foo = ‘bar’;
    console.log(foo) if (foo == 3) {
    console.log(‘baz’)
    }

    This is not only untidy – it is invalid javascript.

    Thanks for the otherwise awesome plugin,
    Zak

    1. Have you selected a code block while validating? In this case only the selected block is validated. You can change this behavior in the plugin preferences.

        1. I see! This is IMHO a bug in the Coda API – the API seems to deliver the folded text, not the file contents when calling [textView string].

          I’ll send them a bug report.

          UPDATE: Is fixed in the next version according to panic.

  9. Your 3.5 beta plugin installed fine for me with Coda 2, thanks for updating it!

    Two issues with HTML formatting: my Coda editor preference is 2 spaces per indent, but my code is getting formatted with 4 spaces. Also, it would be great if when formatting a template fragment the formatter could be told to not add html/head/body tags and just format my div.

    This is definitely a must-have plugin for php/html work, it’s great!

    1. Hi –

      – The second issue should be resolved by selecting “Body only” as HTML Tidy configuration in the plugin preferences.
      – About the number of spaces: I’ll have look, is on the todo list..

  10. I installed the new beta plugin with Coda 2. It installs, but all the menu options are greyed out.

    I’m also getting frequent crashes.

    I have removed/reinstalled several times.

    Is there anything I can do to help diagnose? Thank you! I appreciate your work.

    1. The menu options are greyed out if no file is open or the current file is empty.

      Please have a look that the plugin isn’t installed twice: Go to (your user folder)/Library/Application Support/Coda 2/Plug-Ins and check if there is more than one file starting with “PhpPlugin..”.

      (Kind of) Resolved via email: Seems to be a local problem with one user on one mac.

  11. Working great for me so far on Coda 2. Used this on Coda 1 and loved it for validating/tidying PHP and JS.

    I had Coda 2 running, never closed it, unzipped the file, double-clicked the PhpPlugin.codaplugin file, and viola.

    Many thanks for your good work on this.

  12. Hallo Mario

    I am also getting the NSInvalidArgumentException error. I have removed the plugin from the old Coda folder restarted etc. but still the same error when I try to validate PHP.

    Schö,
    Sebastian

  13. i accidently installed with coda 2 and its crashing and i cant figure out a way to get it back working

  14. Is it compatible with coda 2? My Installation crashed hard when trying to install it on coda 2.

    Thanks

    1. Hi –

      this should not be necessary, because the plug-in automatically detects what you selected for the current file.

      In the menu “Text” there’s an entry “Use Tabs” which is selected if tabs are enabled – and deselected for spaces.

      If that doesn’t do it – with which function do you have problems?

      mario

      1. Well, don’t work. When I press: cmd + alt + shift + H to auto indent the plugin convert all tab indent to 4 space.

        Another question: Every empty element disappear, why?

        1. The handling of empty elements depends on how HTML tidy works, P-tags are i.e. not removed but empty inline elements – like SPAN for example.

          About the tab/spaces-error: It seems there’s a bug in just this function. I’ll have a look. You can use “Text > Entab” in the Coda menu as a workaround until I’ve got a new version ready.

          1. Weird, when I try, even the empty divs are removed.

            LOL, I don’t know this function exists (entab and detab).

            One more thing (another one) why script tags don’t break line:

            Before:

            After:

              1. Ok :(

                Unfortunately I don’t understand how I can make the custom config.

                The default option is near to perfect for everything, but missing some fine tweaks like break 2 labels. I know, labels are inline elements but for visualize the code breaking some lines helps

                1. You just select “Custom..” and the textfield below becomes editable. There you can enter the configuration options, one per each line. You should also see a default setting in the textfield. The documentation link there opens the tidy configuration documentation webpage.

  15. Hi i love the idea of having my code validated and reformatted. Unfortunately i can not getting this to work. I’m on Lion 1.7.3 and are using latest php plug-in and coda. I’m receiving this message each time i call the plug-in: “Tidy returned nothing. Make sure the file has no errors, try using UTF-8 encoding.” I do get this also for PHP JS. On-line validation does work but non of the Tidys. Can some one help me on this. I did several new installs with no luck. thanks for any suggestions.

    1. Hi –

      please go to Plug-ins/PHP & Web Toolkit/Preferences and select the “Advanced” tab. The check if the PHP executable is correct: Usually it’s “/usr/bin/php”. Below it there should be a line showing the found PHP version. Which version is found?

      If that seems correct.. please enable “Debug mode” (on the same screen), open “Console”, reproduce the error in Coda and copy the lines starting with “[Coda PHP Toolkit]”.

      1. Hi Mario
        thanks for that fast response. I have attached the requested file. Btw. i was able to tidy php but no luck for any JS, CSS or HTML. I have only one other Plug-in installed (Typoscript) but the problem persist whether the other plug-in is installed or not. thanks again. Here is the error message: http://www.ilink.ch/coda_php_toolkit_error.txt

        1. That’s strange..

          Could you open the terminal and try to execute the following line (all in one line):

          “/Users/administrator/Library/Application Support/Coda/Plug-ins/PhpPlugin.codaplugin/Contents/Resources/tidy” -help

          Now you *should* see help and a list of options for HTML tidy – if not just copy the output.

          1. Hi – when i do this command i only get “Operation not permitted” as output. it doesn’t change when i su the command.

              1. Hey Mario – I had this same problem. Did you resolve the issue, if so, how? This plugin used to work for me when I had previously installed coda – but recently had to wipe my machine.

                I’ve restarted coda, checked the plug-ins folder (this is the only plug-in i’ve installed so far), and have gone through the steps above.

                Any tips would be greatly appreciated. Thanks.

                1. An updated version seems to have solved the problem, in case of problems, check out the modified version (see above, in downloads).

  16. I love this plugin and use it every day without fail! A real life-saver!

    Although being a predominant PHP developer, as I am starting to work with JavaScript (and more specifically jQuery) I have found one niggily thing.

    I would love it if when going to JS > Minify Javascript; if I have a section already highlighted, Minify just this section (and the same with Tidy Javascript). I normally use a script.js file to concatinate my scripts. And I like to Tidy the section before I start work on it, and then Minify just this section once I am done (sometimes I will leave another section “Tidied” as I am already working on it).

    Also if may be an idea to allow (in Preferences) a setting to leave Comments when Minifying (as sometimes Licences need to remain….

  17. I love this for PHP but haven’t been able to get it working for html in version 3.4. If I click ‘validate html’ I get

    dyld: unknown required load command 0x80000022

    if I click ‘tidy’ I get

    ‘Tidy returned nothing. Make sure the file has no errors, try using UTF-8 encoding.’

    I’m using the html 5 meta tag

    but this doesn’t change if I use the old html4 version

    1. Hi –

      I think it’s about the 4th or 5th time I get asked this :)

      But since I don’t use Espresso and the API is completely different I currently don’t have any plans (and no time..) to port it to Espresso.

  18. I keep hunting for the perfect and all in one code editor and I’m on a mac, but it seems I’m always finding shortcomings in one or the other. Here’s the problem I’m having with the Tidy HTML on Coda.

    I often have PHP and HTML in the same file and when using the Tidy HTML command it rearranges the HTML, like moving the doctype to the very top, basically breaking everything. I see that if you have an html file without the basic html page structure (….) the ‘tidy html’ adds it in which is nice, but it also adds it in incorrectly when having php + html.

    If I want to run some php code before the html I can’t use the ‘tidy html’ because it breaks the code. Is there anyway around this? I have used stuff similar to tidy html such as “command + shift + f” with titanium studio and it works like a charm – keeping your code where it’s at, but making it ‘tidy.’ Also in net beans “contol + shift + f” – this works also fine.

    It doesn’t even seem to fix the code correctly when only having html in an html file:
    For example when I have this code (just some html elements, no html structure) in Coda:

    1. How does Mary’s garden grow?

    Roses and Violets

    Sunshine and Rain

    Silver Bells and Cockle Shells

    Purple Balls and Copper Dolls

    Then I use ‘tidy html” if gives me this: (even when only on an html file, with only html code)

    9. What color were the buttons on Ms. Mary Mack’s dress? Black
    White
    Silver
    Gold

    Not sure if you can tell, but it brings the up one line, to the end of the p tag. Any idea why? Is something wrong with the plugin that I have? I can’t tell a version or anything but when I “view package contents’ it looks like the files were last modified on Jan 27 2012. Not sure if that helps or not.

    I really want to switch to Coda but this is the main thing holding me back. Do you know of any other ‘tidy’ methods or code formatting for Coda? Or can you help me with a fix?

    Any help is greatly appreciated.

    1. Hi –

      HTML tidy in some cases breaks PHP code, that’s a problem with HTML tidy itself (which I can’t fix of course). You can try other settings in the plugin, but the most easy way is to send me an example file via email (HTML isn’t allowed in the comments here) together with an explanation of what went wrong.

      My email address is mario at (the domain of this blog).

      About the plugin version: Just use “Check for updates” in the plugin menu.

      thx,
      mario

  19. Hi! I love this plugin.

    One problem: I use Isolator, and I notice if I this plugin has a pop-up on the screen, and then I switch to another window, the pop up stays there. I don’t think this is a bug with Isolator, as all Isolator does is hide the application. I can replicate it happening without Isolator by using your plugin, then switching to another app and clicking alt-cmd-h.

    Also, I’m a beta tester for Coda 2, and I notice in Coda 2 that all the command shortcuts are gone. Any plans on bringing those back? Is this a bug?

    Thanks again for a great plugin!

    1. Hi –

      I assume you mean the semi-transparent black popup? Are you using Growl notifications – in this case the popup should disappear after a few seconds. I’ll have a look for the next version why the other popup doesn’t correctly fade out.

      Regarding the next Coda version:

      It might be the plugin API has changed or a bug in the current alpha version – but there’s no new API documentation released from Panic, so we’ll have to wait. As soon as it’s released I’ll have a look of course (and hope for new API features). And: I strongly assume it won’t be a problem to integrate the keyboard shortcuts in the final release.

      1. Thanks for the quick response! I am using growl, but this happens whether growl is running or not. Perhaps a screenshot would help?

        https://img.skitch.com/20120217-qfkpd2aih6xma82tkxxnhb3m21.jpg

        Here’s me browsing your website after validating PHP in Coda. This little popup doesn’t go away unless I switch back to Coda, re-validate using your plugin, and wait for it to fade out. Then I can safely switch to another application without the popup staying there permanently.

        1. Okay I see – might be a problem with growl, I’ll have a look as soon as I start with the next update (which hopefully is the release for 2.0).

  20. Hi there,

    your plugin generates a generic message (PHP & Web Toolkit) each time I launch Coda. In parenthesis it says it will show this message only once after updating, but as I said, it shows up every single time I launch Coda.
    I reinstalled Coda and downloaded the plugin again but it didn’t help.

    Your help would be much appreciated.

    -Franco

      1. Thanks Mario. I had checked if the plugin was installed twice, but that was not the case. I also checked the console, but I couldn’t find any useful information.

        Could it be some kind of permission problem by which the plugin can’t write to a file?

        -Franco

        1. That’s strange because it’s using the standard OS X methods and writes to the Coda prefs file (~/Library/Preferences/com.panic.coda.plist). There’s a key “dechipwreckPrefLastVersionRun” which stores the last version number.
          Which version do you use?

          1. The latest and greatest. There was indeed a problem with accessing the preference file. Not sure what kind of problem, but it is fixed now.

            Thanks for your help,
            Franco

    1. Hi –

      which function causes this error?

      If this happens when using “php validation” then it might be the plugin can’t find the PHP binary. The path to the PHP binary can be found here:
      Plug-ins > PHP & Web Toolkit > Preferences > Advanced
      There you can enter the path to the PHP binary, which usually is /usr/bin/php.

      Maybe this helps – otherwise I need to know which function causes the exception.

      thx,
      mario

  21. Ever thought about developing this into a sugar for espresso? I just made the switch from coda to espresso. This is an invaluable asset. I would definitely pay if I had to

    1. Hi –

      well I had a look at the Espresso API and It’s completely different to the Coda API. And since I don’t use Espresso (tried it several times and was not very impresed) I don’t see a chance of me developing this for Espresso..

      (But nice to hear that it’s so useful to you :)

  22. Tidy HTML is giving me extra blank lines where it’s not needed.
    For example I want the code to format like this:

    something
    something

    But using the Tidy HTML feature would result in this:

    something

    something

    Any idea how to get rid of the blank line? I tried using Custom settings in the Configuration, but no luck. Any help would be appreciated.

    Thanks.

Leave a Reply to Mario 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.