Sublime Forum

Need help to create snippets?

#1

Hello ;
I would like to create snippets for those code but when I try to write that it doesn’t work : may be the problem is $ sign in the beginning and php symbol !!

the first code is

<?php if($result!=null):
								
 foreach ($result as $r): ?>
							 
 //code here
					 
 <?php endforeach;endif; ?>

and the second code is :

if($query->num_rows()>0)
{
 foreach($query->result()as $row)
 {
	 $data] = $row; 
 }
																											 
	return $data;
 }

and I write that

<snippet>
	<content><![CDATA[
if(\\$${1:query}->num_rows()>0)
{
  foreach(\\$${2:query}->result()as \\$${3:row})
	{
		\\$${4:data[]} = \\$${5:row}; 
	}
		
	   return \\$${6:data};
}
]]></content>
	<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
	<tabTrigger>if_query</tabTrigger> 
	<!-- Optional: Set a scope to limit where the snippet will trigger -->
	<!-- <scope>source.python</scope> -->
</snippet>

thanks can you correct please whta’s wrong and how abut the other code

thanks :smiley:

0 Likes

#2

Try a single \

0 Likes

#3

thanks it works :astonished:

:smiley:

0 Likes