I find my self wrapping html code very frequently. It is a pain but I do not know how to work with regex,
Basically I need to use echo "" to wrap the html code and escape all of the other " in it.
can someone help me? Please.
-Thansk -L
If I'm understanding your request correctly create a command with the following values:
Save: Nothing Command(s): /usr/bin/php -r "echo addslashes ( '$TM_SELECTED_TEXT' );" Input: Selected Text or Nothing Output: Replace Selected Text
Assign whatever key equivalent you wish to use and change the path for the PHP binary to whatever is appropriate. You can also replace addslashes() with str_replace () for greater flexibility in what you is escaped.
Charley
luismcdougall wrote:
I find my self wrapping html code very frequently. It is a pain but I do not know how to work with regex,
Basically I need to use echo "" to wrap the html code and escape all of the other " in it.
can someone help me? Please.
-Thansk -L
At 8:45 Uhr -0700 31.05.2007, luismcdougall wrote:
I find my self wrapping html code very frequently. It is a pain but I do not know how to work with regex,
Basically I need to use echo "" to wrap the html code and escape all of the other " in it.
can someone help me?
Sorry I can't help you, but wouldn't it be better to use echo '' (single quotation marks) and leave the HTML " (double quatation marks) untouched?
Example: Before: <a href="some_file.php" title="this is a link">click here</a> After: echo '<a href="some_file.php" title="this is a link">click here</a>';
Kind regards, Tobias Jung
Wouldn't it be better not to echo out all that html? Chances are you don't need to, so escape from PHP mode back into HTML, and write your HTML... the way it should be...
On Jun 2, 2007, at 6:38 PM, Tobias Jung wrote:
At 8:45 Uhr -0700 31.05.2007, luismcdougall wrote:
I find my self wrapping html code very frequently. It is a pain but I do not know how to work with regex,
Basically I need to use echo "" to wrap the html code and escape all of the other " in it.
can someone help me?
Sorry I can't help you, but wouldn't it be better to use echo '' (single quotation marks) and leave the HTML " (double quatation marks) untouched?
Example: Before: <a href="some_file.php" title="this is a link">click here</a> After: echo '<a href="some_file.php" title="this is a link">click here</a>';
Kind regards, Tobias Jung
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Actually, there are times when I'm "buffering" the output of the html by saving the results of the logic into a variable and the ob_* functions are not appropriate. In that case, I need to be able to escape the html, whether it's using single quotes or double quotes to define the strings. I don't want anything output until the logic has run it's course.
I'm guessing the original poster has similar requirements. Not to mention that it may well be a matter of preference.
Charley
Eric Coleman wrote:
Wouldn't it be better not to echo out all that html? Chances are you don't need to, so escape from PHP mode back into HTML, and write your HTML... the way it should be...
On Jun 2, 2007, at 6:38 PM, Tobias Jung wrote:
At 8:45 Uhr -0700 31.05.2007, luismcdougall wrote:
I find my self wrapping html code very frequently. It is a pain but I do not know how to work with regex,
Basically I need to use echo "" to wrap the html code and escape all of the other " in it.
can someone help me?
Sorry I can't help you, but wouldn't it be better to use echo '' (single quotation marks) and leave the HTML " (double quatation marks) untouched?
Example: Before: <a href="some_file.php" title="this is a link">click here</a> After: echo '<a href="some_file.php" title="this is a link">click here</a>';
Kind regards, Tobias Jung
Tobias, I do agree with you. It is what I am doing. I do not know why I did write my message explaining it in that fashion.
Tobias Jung-2 wrote:
At 8:45 Uhr -0700 31.05.2007, luismcdougall wrote:
I find my self wrapping html code very frequently. It is a pain but I do not know how to work with regex,
Basically I need to use echo "" to wrap the html code and escape all of the other " in it.
can someone help me?
Sorry I can't help you, but wouldn't it be better to use echo '' (single quotation marks) and leave the HTML " (double quatation marks) untouched?
Example: Before: some_file.php click here After: echo ' some_file.php click here ';
Kind regards, Tobias Jung
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
I'm still not quite certain what you're doing, but you might find it useful to know that you can insert an escaped pair of quotes by typing ⌘" (that's shift-command-' on my keyboard).
If you already have HTML code in a PHP scope, then surely it's already wrapped in quotes?
On 3 Jun 2007, at 01:45, luismcdougall wrote:
Tobias, I do agree with you. It is what I am doing. I do not know why I did write my message explaining it in that fashion.
Tobias Jung-2 wrote:
At 8:45 Uhr -0700 31.05.2007, luismcdougall wrote:
I find my self wrapping html code very frequently. It is a pain but I do not know how to work with regex,
Basically I need to use echo "" to wrap the html code and escape all of the other " in it.
can someone help me?
Sorry I can't help you, but wouldn't it be better to use echo '' (single quotation marks) and leave the HTML " (double quatation marks) untouched?
Example: Before: some_file.php click here After: echo ' some_file.php click here ';
Kind regards, Tobias Jung
_ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
-- View this message in context: http://www.nabble.com/PHP-echo-wrap- tf3847294.html#a10932640 Sent from the textmate users mailing list archive at Nabble.com.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 3 Jun 2007, at 10:09, Ciarán Walsh wrote:
I'm still not quite certain what you're doing, but you might find it useful to know that you can insert an escaped pair of quotes by typing ⌘" (that's shift-command-' on my keyboard).
If you already have HTML code in a PHP scope, then surely it's already wrapped in quotes?
I think the problem is this:
<a href="http://hexten.net/">Hexten</a>
which the OP then turns into
echo "<a href="http://hexten.net/">Hexten</a>"
and they want
echo "<a href="http://hexten.net/%5C%22%3EHexten</a>"
I try to avoid that (and PHP :) but on the occasions when I do it I just mark the string and S&P " -> ".