Home Download Buy Blog Forum Support

need help to create snippets ?

need help to create snippets ?

Postby ludo31 on Wed Mar 14, 2012 9:04 pm

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

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


and the second code is :

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


and I write that

Code: Select all
<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 :D
ludo31
 
Posts: 11
Joined: Sun Mar 04, 2012 2:44 pm

Re: need help to create snippets ?

Postby C0D312 on Wed Mar 14, 2012 9:13 pm

Try a single \
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: need help to create snippets ?

Postby ludo31 on Sat Mar 17, 2012 9:26 pm

C0D312 wrote:Try a single \


thanks it works :o

:D
ludo31
 
Posts: 11
Joined: Sun Mar 04, 2012 2:44 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot] and 11 guests