Suppose I am in the html grammar with a php block, like: <?php echo 'my insertion point is here'; ?>
my expectation is to have ctrl-return produce <br /> rather than the \n given that I am within the '".
am I wrong on this ?
On Oct 20, 2006, at 11:04 AM, David Clark wrote:
Suppose I am in the html grammar with a php block, like:
<?php echo 'my insertion point is here'; ?>
my expectation is to have ctrl-return produce <br /> rather than the \n given that I am within the '".
am I wrong on this ?
It's a mistaken expectation, since there's really no way of knowing whether the context for the quoted string is HTML, SQL, etc. (and there are valid reasons for having php return a newline even in the context of HTML).
You could edit the scope selector on the br snippet in the HTML bundle to include string.quoted.single.php (and I'd include string.quoted.double.php to be safe).
If you really want to have HTML scope for a string literal you can use a heredoc with 'HTML' as the terminator:
<?php echo <<<HTML <p>This is html</p> HTML; ?>
this will give you HTML highlighting and commands etc for the length of the heredoc. It also works for 'SQL'.
You can check what the current scope is at any time with control-shift-P
If you're simply *outputting* HTML from a PHP script, the best way to do that is just to end and restart the PHP tags:
<?php echo 'This is PHP\n'; ?>This is HTML<br /><?php ?>
This is good because it is processed faster and uses less memory (the HTML is not even evaluated by the PHP parser), as well as keeping HTML in its own context.
Q
On Fri, 20 Oct 2006 17:01:15 +0100, Ciarán Walsh wrote:
If you really want to have HTML scope for a string literal you can use a heredoc with 'HTML' as the terminator:
<?php echo <<<HTML <p>This is html</p> HTML; ?>
this will give you HTML highlighting and commands etc for the length of the heredoc. It also works for 'SQL'.
You can check what the current scope is at any time with control-shift-P
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