Differences

This shows you the differences between the selected revisions of the page.

2015-08-31 2016-01-07
&man_ref (martin) url address using local command (martin)
Line 56: Line 56:
===== [[url]] URL Address of Selected File ===== ===== [[url]] URL Address of Selected File =====
 +==== Using Local Command ====
 +Example shows how to use local custom command that maps file path to URL.
 +<code>!`cmd.exe /c echo @echo off > %TEMP%\url.bat &
 +echo set FILE_PATH=%1 >> %TEMP%\url.bat &
 +echo echo http://www.example.com%FILE_PATH:home/user/public_html=~user% >> %TEMP%\url.bat`
 +cmd.exe /c %TEMP%\url.bat !/! & pause</code>
 +
 +Hints:
 +
 +  * Note that the above should be entered as one line!
 +  * Check custom command options //Local command// and //Use remote files//.
 +  * If you want to copy the %%URL%% to clipboard instead of displaying it, replace the trailing ''& pause'' with ''| clip''.
 +  * For your particular use, just replace ''%%http://www.example.com%%'' with right %%URL%% prefix, ''home/user/public_html'' with right path prefix and ''~user'' with right %%URL%% replacement (it can even be empty in some cases).
 +
 +==== Using Remote PHP Code ====
Example shows how to launch simple PHP script that maps file path to URL. Example shows how to launch simple PHP script that maps file path to URL.
-<code>echo '<?="http://www.example.com". +<code>echo '<?="http://www.example.com".str_replace("home/user/public_html", "~user", "'`pwd`'")."/!\n"?>' | php -q</code>
-str_replace("home/user/public_html", "~user", "'`pwd`'"). +
-"/!\n"?>' | php -q</code>+
Hints: Hints:
Line 67: Line 80:
  * Note that the above should be entered as one line!   * Note that the above should be entered as one line!
  * Do not forget to check custom command option //Show results in terminal// or //Copy results to clipboard//, otherwise you will not get the results. You may also want to use the command for directories, check //Apply to directories// too.   * Do not forget to check custom command option //Show results in terminal// or //Copy results to clipboard//, otherwise you will not get the results. You may also want to use the command for directories, check //Apply to directories// too.
-  * For your particular use, just replace ''%%http://www.example.com%%'' with right URL prefix, ''home/user/public_html'' with right path prefix and ''~user'' with right URL replacement (it can even be empty in some cases).+  * For your particular use, just replace ''%%http://www.example.com%%'' with right URL prefix, ''home/user/public_html'' with right path prefix and ''~user'' with right %%URL%% replacement (it can even be empty in some cases).
  * If you do mapping like above, i.e. for server containing multiple user's homepages, you can make it universal by replacing ''user'' with ''%%'`whoami`'%%''.   * If you do mapping like above, i.e. for server containing multiple user's homepages, you can make it universal by replacing ''user'' with ''%%'`whoami`'%%''.
-Another example using shell commands only, in case PHP is unavailable.+==== Using Remote Shell Code ==== 
 + 
 +Another example using shell commands only, in case PHP is not available:
<code>echo 'http://www.example.com'`pwd`'/!' | sed s#home/user/public_html#~user#</code> <code>echo 'http://www.example.com'`pwd`'/!' | sed s#home/user/public_html#~user#</code>
 +
===== Templates ===== ===== Templates =====

Last modified: by martin