Hi,
sometimes I test anything (like html page and perl scripts) writing directly on Desktop, first to pass them in the correct localhost web site folders, so I've set Apache to handle also $USER/desktop as localhost directory. I try to put in bundle editor, html this line:
open `echo $TM_FILEPATH | sed "s|.*/$USER/Sites/(.*)|http:// localhost/~$USER/desktop/\1|"`
but it doesn't work
Please, there is a solution?
Many thanks in advance
Salvo
On 06/10/2005, at 11.24, salvo wrote:
sometimes I test anything (like html page and perl scripts) writing directly on Desktop, first to pass them in the correct localhost web site folders, so I've set Apache to handle also $USER/desktop as localhost directory. I try to put in bundle editor, html this line:
open `echo $TM_FILEPATH | sed "s|.*/$USER/Sites/(.*)|http:// localhost/~$USER/desktop/\1|"`
You probably want:
open "`echo $TM_FILEPATH | sed "s|.*/$USER/Desktop/(.*)|http:// localhost/~$USER/desktop/\1|"`"
Which makes a file path of e.g. /Users/duff/Desktop/test.html into http://localhost/~duff/desktop/test.html
You can also use the shells ability to chop off a prefix ($HOME points to your home folder), e.g.: open "http://localhost/~%24USER%24%7BTM_FILEPATH#%24HOME%7D"
If you do spell Desktop in different case (lowercase for the URL): open "http://localhost/~%24USER/desktop%24%7BTM_FILEPATH#%24HOME/Desktop%7D"
Btw: instead of opening the URL, you can also set the commands output to HTML and then let it redirect to the URL, so you'll view the page inside TextMate: echo "<meta http-equiv='Refresh' content='0;URL=http://localhost/~ $USER${TM_FILEPATH#$HOME}'>"
I recently blogged about both shell variable substitutions and HTML output capabilities: http://macromates.com/blog/archives/2005/09/28/html-output-for- commands/ http://macromates.com/blog/archives/2005/09/26/shell-variables/
Il giorno 06/ott/05, alle ore 12:19, Allan Odgaard ha inviato questo messaggio:
You probably want:
open "`echo $TM_FILEPATH | sed "s|.*/$USER/Desktop/(.*)|http:// localhost/~$USER/desktop/\1|"`"
ok! this line works well and open a .pl page on desktop ad cgi in localhost.
Btw: instead of opening the URL, you can also set the commands output to HTML and then let it redirect to the URL, so you'll view the page inside TextMate: echo "<meta http-equiv='Refresh' content='0;URL=http://localhost/ ~$USER${TM_FILEPATH#$HOME}'>"
thanks, a good tip, this one!
I recently blogged about both shell variable substitutions and HTML output capabilities: http://macromates.com/blog/archives/2005/09/28/html-output-for- commands/ http://macromates.com/blog/archives/2005/09/26/shell-variables/
I must read them soon, thanks!
REgards
Salvo
On 6 Oct 2005, at 10:24, salvo wrote:
sometimes I test anything (like html page and perl scripts) writing directly on Desktop, first to pass them in the correct localhost web site folders, so I've set Apache to handle also $USER/desktop as localhost directory. I try to put in bundle editor, html this line:
open `echo $TM_FILEPATH | sed "s|.*/$USER/Sites/(.*)|http:// localhost/~$USER/desktop/\1|"`
but it doesn't work
Please, there is a solution?
Salvo, not the most obvious place to look, but have you looked at the HTML -> Preview in Safari command ? In there it says the following:
### CONFIG OPTION:: Set the TM_PROJECT_SITEURL in your TM Project Window Info Button in the following form: ### [ http://your.site.ext/ ]
So if you set your TM_PROJECT_SITEURL variable there, the preview in should work through the browser and localhost.
Long time since I created it and actually used it, but should work afaik ;)
Kind regards,
Mats
---- "TextMate, coding with an incredible sense of joy and ease" - www.macromates.com -
Il giorno 06/ott/05, alle ore 12:20, Mats Persson ha inviato questo messaggio:
Salvo, not the most obvious place to look, but have you looked at the HTML -> Preview in Safari command ?
Hi Mats, with html this's ok, but with php or perl pages this one open the page as plain text and doesn't run the server, instead as localhost, with Apache, we could run perl or php modules and its server's services.
In there it says the following:
### CONFIG OPTION:: Set the TM_PROJECT_SITEURL in your TM Project Window Info Button in the following form: ### [ http://your.site.ext/ ]
So if you set your TM_PROJECT_SITEURL variable there, the preview in should work through the browser and localhost.
However, I couls try this tip as well, thanks.
regards
Salvo
On 6 Oct 2005, at 14:26, salvo wrote:
Hi Mats, with html this's ok, but with php or perl pages this one open the page as plain text and doesn't run the server, instead as localhost, with Apache, we could run perl or php modules and its server's services.
Salvo, I just checked it out again and YES, "Preview in all running browsers" does work with both HTML and PHP or through the Apache web server for any other language.
Assuming that you have your project files in this directory /Users/ <you>/Sites/desktop/
Just click the Info button in the TM Project drawer on your project, and then add the variable TM_PROJECT_SITEURL to [ http://localhost/ desktop/ ]
Now it will work with any other file in sub-directories as well, such as ../desktop/subfolder/subfolder2/index.php
Kind regards,
Mats
---- "TextMate, coding with an incredible sense of joy and ease" - www.macromates.com -
Il giorno 06/ott/05, alle ore 19:00, Mats Persson ha inviato questo messaggio:
Salvo, I just checked it out again and YES, "Preview in all running browsers" does work with both HTML and PHP or through the Apache web server for any other language.
Very good Mats, this works well for a project, ok. But if we haven't a project, but a single file?
I think no.
However many thanks, your is a useful tip for the project works.
Salvo