Coda PHP Toolkit – Help
Posted 4 months ago.
- Download / Feedback •
- Help •
- Coda Tips
Requirements • Installation • Usage • Troubleshooting/FAQ • Credits/License • Changelog
Requirements
- Coda 1.6.3 (or higher) from panic.com »
- OS X 10.5 or higher
Installation
- Download, unzip and doubleclick the Coda-plugin file. Restart Coda if necessary.
- Make sure you use the latest version: Use
Check for Updates
in the About-window. - In the Menu, select “Plugins” and then “Coda PHP Toolkit”.
Coda plugins are installed in ~/Library/Application Support/Coda/Plug-ins/
Usage: General
- All functions are applied to the file currently opened in the editor.
- If necessary you must select the file encoding:
ASCII, UTF-8, UTF-16, ISO 8859-1 (Latin 1), Windows CP-1252 or MacRoman.*
* If all your files use the same encoding, you can pre-select this encoding in the preferences.
Preferences
File Encoding
Set a default encoding (For example: if you always use UTF-8 files, set encoding to UTF-8 to save you the dialogue).
Check for Updates
Automatically check for a new version each time Coda starts.
Auto Save
Simply leave it off, not used anymore. It’s not present anymore in the current version.
Debug Mode
Use this to view debug information in the console (and send these to me if you encounter problems).
Online Validation
Here you can change the URL and the fieldnames for online validation, use this if a web service has changed its address.
File Locations
If you want to use other binary versions than the ones that come with OS X (For example: Another PHP version), you can set the file location here.
Tidy config
This button opens a text file which you can customize to change the format of HTML tidy (will be overwritten with the next update, so keep a copy somewhere).
CSS tidy
Select the format in which CSS tidy outputs your file – low compression means: Very readable with newlines and spaces, higher compression: Less space used, but also less readable. Simply try out what works best for you.
HTML tidy
Select the format in which HTML tidy outputs your file – Simply try out what works best for you. Note: “Body only” is quite experimental, works well with HTML snippets, but removes DOCTYPE and header (if present).
Validate PHP
Check PHP file for syntax errors
If an error occurs, choose “Go to line” and the cursor will be moved to the appropriate line:
Note: If the line is out of focus, it’s not automatically scrolled – this is a drawback of the current Coda API.
Tidy PHP
Clean up and reformat PHP code
This sends the file to PHPtidy, which cleans it up and reformats PHP Code — Use this for PHP files which are unreadable or chaotic.
Validate HTML
Check HTML files for Validity
If the file is valid, you see an information window like this:
If there are errors, a new window opens – listing the problems HTML tidy found:
Validate HTML W3C / Validate CSS W3C
Online validation of html/css files
The current file (=its source code) is sent to the w3c-validation service for HTML- or CSS-files. The result is shown in a new window. You have to be online of course.
The output is missing some images, but nevertheless you can see what’s wrong or not.

Tidy HTML
Reformat the currently open HTML-file.
Use this to reformat the HTML-code.
Note: The format can be specified (in 5 variants) in the Preferences.
Tidy CSS
Reformat the currently open CSS-file.
Use this to reformat the CSS-code.
Note: The format can be specified (in 4 variants) in the Preferences.
Strip Whitespace and Comments
Removes all comments and whitespaces from a PHP file.
Useful to save space or to clean up a file you won’t be editing further.
Troubleshooting ~ FAQ
- How to submit bugs/comments?
Simply post a comment here ».
- The plugin complains about file encoding, why?
It’s not possible to read the file encoding from Coda at the moment, so you have to select the encoding manually.
At the moment you can choose ASCII, UTF-8, UTF-16, ISO 8859-1 (Latin 1), Windows CP-1252 or MacRoman.- The PHP errorbox only shows
Errors Parsing -
, nothing more Seems you set display_errors to off in your local php.ini (usually in /etc/php.ini) – Comment out that line (with a leading #). This is fixed since 1.4 – so maybe simply update the plugin.
- I’ve got a PowerMac and Validate HTML/HTML Tidy doesn’t work
Error – No output received in replaceEditorTextWith
Simply update to the latest version.
Yes, the included binary of tidy is intel-only. Universal binary will be available in an upcoming version.- I use OS X 10.4 (Tiger) and Coda/the plugin crashes
Yes, the requirement is OS X 10.5+, so an update would be the easy solution.
If I find some time I’ll maybe try to modify the code so that it works with 10.4.
- Tidy HTML is nice, but afterwards my PHP code is broken?!
If you use short PHP-tags inside attributes like this:
a href="<?=getLinkTarget() ?>"Tidy
cleans
it, in this case use complete php-tags for the attribute value in single quotes:a href='<?php echo getLinkTarget(); ?>'Or use can use TidyPHP , and have a look at the output – undo is your friend :).
- I get this error:
Undefined response received, please report this error.
Simply update to the latest version.
- How to remove aka uninstall the plugin?
Close Coda, go to your_home_folder/Library/Application Support/Coda/Plug-ins/ and delete the file PhpPlugin.codaplugin – that’s it.
- After executing some function something has gone awfully wrong/I get an exception, why?
Please enable debug messages in the preferences and post a comment here ».
Note: There’s always Undo (Cmd-z) to get back the previous file content.
- What’s the difference between the validation functions?
Validate HTML W3C
uses the W3C-Service (suprise..),Validate HTML
uses Tidy (tidy.sourceforge.net). Both generally do the same, but tidy reports for example useless empty tags – which are according to the W3C standard of course valid.- The formatting of the tidy-thing is not what I want – how can this be configured?
Now it’s configurable, so update to the latest version.
- This plugin has helped me/saved my life/I’d like to support the development – what can I do?
You could write a comment, spread the word or donate some dollars/euros via paypal:
- Why do I have to select the encoding? Why is feature XY not yet integrated ?11!!1??
Two reasons – first: I’ve started this for my private entertainment and work on it in my spare time. So things might take longer.
Second point: I can only use the functions provided by Panic via the Coda API – and many things are simply not (yet) there, like: Which is the encoding of the current file? Or: Get URL from Browser Preview and so on…
Credits
Using phptidy (cmr.cx/phptidy), HTML tidy (tidy.sourceforge.net) and CSS Tidy (csstidy.sourceforge.net).
License
This software is copyright Mario Fischer 2008-2010. It is free for personal and business use, redistribution only without modifications.
Donations are welcome.
This software is provided by chipwreck.de ‘as is’ and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall chipwreck.de be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
Changelog
1.7
HTML tidy now configurable (in the Preferences) !
Preferences are automatically saved
Bugfix when saving Coda Prefs
1.62
Automatic update check now in the background (asynchronous)
CSS tidy now configurable (in the Preferences) !
Less intrusive error-messages on connection failures
1.6
User Preferences
Automatic check for updates
CSS tidy integrated
Structured Menu (aka Submenus)
Using the HTML-tidy version delivered with OSX (PowerPC compatible)
Redesigned the error- and “validation okay”-sheets XCode-like
More encodings: ASCII, UTF-16, Windows CP-1252
All functions use the current buffer contents now
Error messages not explicitely state their origin
Updated phptidy to current version 2.10
1.4
W3C-Validation online for HTML-files
W3C-Validation online for CSS-files
Help button (on the about sheet) now opens this page
1.31
W3C-Validation service, 1st try
1.3
Improved Sheet display
Bugfixes
1.13
Validate HTML (via tidy)
Jump to error line – if PHP validation finds an error
Check for Updates (in the about-box)
File encoding can be chosen
Nice sheets, no more of those ugly alert-boxes
Menu items are only available if they should be
Lots of code cleanup
More useful “About”-dialogue, link to the plugin homepage
0.96
“About..”-dialog
Improved exception handling
Bugfixes
0.9
New features: HTML tidy, Strip PHP, PHP tidy
Included HTML Tidy
Included phptidy
Bugfixes
0.85
Bugfixes, dialogs updated
0.8
Initial release




Share & Bookmark