Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use PHP as a scripting language in BBEdit Apps
BBEdit 7.0.2 allows the use of any shell scripting language in its Unix Filters/Scripts framework. If you are a PHP programmer, and have built PHP 4.3.0 or higher on your machine, you should find installed the new CLI (as opposed to CGI) version of the PHP binary (in /usr/local/bin/php), thereby allowing you to (among other things) easily use PHP scripts in BBEdit's Unix Filters/Scripts. The following code demonstrates a simple PHP script that will number the lines in a BBEdit window (and illustrates how to read the input from BBEDit):

#!/usr/local/bin/php
<?
  $input = file($argv[1]) or die($php_errormsg);
    
  $lineNum = 1;
  foreach($input as $line)
  {       
    print($lineNum.": ".$line);
    $lineNum++;
  }
?>
[robg adds: I don't have the CLI version of PHP here, so I can't test this one...]
    •    
  • Currently 4.00 / 5
  You rated: 5 / 5 (5 votes cast)
 
[6,174 views]  

Use PHP as a scripting language in BBEdit | 1 comments | Create New Account
Click here to return to the 'Use PHP as a scripting language in BBEdit' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Re: Use PHP as a scripting language in BBEdit
Authored by: sardu_mac on Feb 28, '03 06:35:26PM


   robg adds: I don't have the CLI version of PHP here...

Its handy for cron stuff, and saved a lot of time when I was testing the code for the RSS 2.0 feeds. Instead of having to make a change to the site to get a new feed generated I just ran a 3-line shell script:

#!/usr/local/bin/php
require_once('/path/to/geeklog/public_html/lib-common.php');
COM_exportRDF();

BTW: Anyone who runs a GeekLog site, that script will regenerate your 'backend/geeklog.rdf' file.



[ Reply to This | # ]