 |
 |
BBEdit and PHP
|
 |
|
 |
|
Forum Regular
Join Date: Apr 2001
Location: NY, NY, USA
Status:
Offline
|
|
I recently added a syntax checker for PHP to BBEdit, which is great, but the next thing I'd like is a script or plugin that takes the PHP code and applies indentation. In other words, if I run the script on the text:
if ($var) {
echo "hello world";
if ($var2) {
echo "goodbye world";
}
}
It will automatically reformat as:
if ($var) {
echo "hello world";
      if ($var2) {
      echo "goodbye world";
      }
}
I realize I can use "balance" and do it manually, but there must be an automatic method. Thanks.
(Last edited by sahara; Mar 30, 2004 at 08:23 AM.
)
|
|
- Sahara
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Aug 2000
Location: NoVA
Status:
Offline
|
|
Sorry I don't have an answer to your question, but can I ask what syntax checker you're using? I would love to have something like that...
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Apr 2001
Location: NY, NY, USA
Status:
Offline
|
|
Originally posted by AlphaQuam:
Sorry I don't have an answer to your question, but can I ask what syntax checker you're using? I would love to have something like that...
I'm still getting used to the balance and shift right method in BBEdit, because it doesn't indent the way I usually do it. I don't want to have to write an AppleScript for this but I can't seem to find one anywhere.
Anyway, copy the syntax checking script on this page. Paste it into an AppleScript and save it inside your BBEdit scripts directory:
http://daringfireball.net/2003/12/ph...king_in_bbedit
It acctually works very well. It pops up the error and then highlights the line with the problem code. Oh, and you must have the command line PHP installed.
|
|
- Sahara
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Aug 2001
Location: Capitol City
Status:
Offline
|
|
Originally posted by sahara:
I'm still getting used to the balance and shift right method in BBEdit, because it doesn't indent the way I usually do it. I don't want to have to write an AppleScript for this but I can't seem to find one anywhere.
Anyway, copy the syntax checking script on this page. Paste it into an AppleScript and save it inside your BBEdit scripts directory:
http://daringfireball.net/2003/12/ph...king_in_bbedit
It acctually works very well. It pops up the error and then highlights the line with the problem code. Oh, and you must have the command line PHP installed.
I would love to do this, but I still only have BBEdit 6.1. I just need to update, but haven't. I'm a slacker. Anyway, look for Javascript Style perl script indentation, (that would probably be your best bet) and throw that in your unix scripts folder in BBEdit Support.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|