Insert pairs of <?php and ?>

When you're writing PHP, and you want to embed a block of HTML, you need to surround the HTML with "?>" and "<?php". Conversely, when you're in the HTML block, and need to embed a little snippet of PHP, you write "<?php echo $something; ?>".

When you type the first part, the rest of the file doesn't parse correctly until you type its matching end. Is there a way to enter  these pairs automatically, similar to the way that typing "(" automatically enters the matching ")", and quotes are automatically paired?

0
2 comments

That works very nicely. I created two templates:

html expands to ?> $CODE$ ?>php

<> expands to <?php echo $EXPR$; ?>

I tried to use "><" as the abbreviation for the first one, but that doesn't get recognized by the TAB expander.

0

Please sign in to leave a comment.