Home Download Buy Blog Forum Support



Postby Perkin5 on Sat Dec 29, 2012 9:49 pm

OK let's say I have a page with a .php extension but consisting mainly of html code. Now I want to insert a snippet of php like this:

Code: Select all
<?php echo "Hello world";  ?>

php tags and all.

How can I do that in ST2? As far as I can see it will only let me insert this if I am already between php tags on the page which defeats the object.

Help please...

Same thing happens if I set it up as an emmet abbreviation by the way.
Posts: 35
Joined: Sat Sep 03, 2011 10:36 am

Re: snippets

Postby agibsonsw on Sat Dec 29, 2012 10:21 pm

You would use the scope text.html.basic. Modified from the default snippet:

Code: Select all
Hello, ${1:this} is a ${2:snippet}.
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <!-- <tabTrigger>hello</tabTrigger> -->
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: snippets

Postby Perkin5 on Fri Jan 04, 2013 5:35 pm

Many thanks!
Posts: 35
Joined: Sat Sep 03, 2011 10:36 am

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 15 guests