Like this?:

$content = file_get_contents($argv[1]);

[.....]

echo $content;

This would be even simpler, although the array Dennis suggested could be very useful as well.
- Peter


On Mar 26, 2008, at 1:16 PM, Carlton Gibson wrote:

On 26 Mar 2008, at 17:46, Dennis wrote:

On Mar 26, 2008, at 10:38 AM, Peter Weil wrote:

What would it take to turn this script into a local BBEdit Unix filter? In particular, what variable do I need to use for content of the file to be filtered?

BBEdit Unix Filters place the selected text in a temp file and pass the path of the temp file in $argv[1]. You can use PHP's "file" function to read the file into an array, one line per element:


file_get_contents() returns the whole file as a string, which would be more like the value returned from a single form field via $_POST...

----------

#!/usr/bin/php
<?php
$inputArray = file ($argv[1]);
$i = 0;
foreach ($inputArray as $line)
{
  $i++;
}
$output = "Number of lines: " . $i . "\n";
?>

----------

Hope this helps,
Dennis

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>


--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>


--
Peter Weil, Web Developer
University Communications
University of Wisconsin-Madison
Phone: 608-262-6538
Email: [EMAIL PROTECTED]




--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to