[TxMt] scoping issue in html/php ??

Quinn Comendant quinn at strangecode.com
Sat Oct 21 01:21:18 UTC 2006


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 at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate



More information about the textmate mailing list