[TxMt] Web preview and PHP files

Andreas Pardeike andreas at pardeike.net
Wed Sep 20 16:19:53 UTC 2006


On 20 sep 2006, at 12.09, Erik Wessel-Berg wrote:

>
> On 20. sep. 2006, at 00.07, Allan Odgaard wrote:
>
>> On 19/9/2006, at 20:08, José Campos wrote:
>>
>>>    It allows web preview of PHP pages. It would be very nice that
>>> TextMate allows it too. Is this on the todo list? Or did I miss a  
>>> step?
>>
>> Well, TextMate is a generic text editor, so things like “live PHP  
>> preview” seems far too task-specific for the feature set I would  
>> like it to have.
>>
>> How does this preview work? does it run its own web server? rely  
>> on the installed apache? If it is something like the latter, a  
>> command could probably be created for TM.
>
> BBEdit also has this feature. It uses, as Allan suggests, the  
> installed apache to parse php.

Huh? I am I the only one that has figured this out? Simply open the  
Web Preview in TextMate
and click on the Show Options checkbox (btw, using a *checkbox* for  
this feature isn't really
the recommended way). Then, in the drawer that opens, enable Pipe  
text through and make sure
the text field below reads /usr/bin/perl. Enable the refresh with  
some reasonable time like
0.5 seconds and off you go.

Ok, you won't get all the bells and whistles like request parameters  
but it's good enough to
preview php-generated markup.

I also guess that it's rather easy to write a small proxy script that  
would run the text
through the build in apache by saving it to a temp file and calling  
apache and piping the
result back into the preview window. Or simply do the same thing but  
use the file the current
front window is pointing at (although I can think of technical  
problems with that approach).

Andreas



More information about the textmate mailing list