Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > BBEdit and PHP

BBEdit and PHP
Thread Tools
Forum Regular
Join Date: Apr 2001
Location: NY, NY, USA
Status: Offline
Reply With Quote
Mar 30, 2004, 08:12 AM
 
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
Reply With Quote
Mar 30, 2004, 11:13 AM
 
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...
     
sahara  (op)
Forum Regular
Join Date: Apr 2001
Location: NY, NY, USA
Status: Offline
Reply With Quote
Mar 30, 2004, 11:44 AM
 
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
Reply With Quote
Apr 1, 2004, 01:17 PM
 
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.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:13 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2