These snippets are to make life easier and faster then before using the Trongate framework. For sure, this will create a better experience and workflow.
The Trongate website is at Trongate website.
The Trongate framework can be downloaded on Github at Trongate framework
As a founding member at Speed Coding Academy, with Trongate, companion tools, and these snippets, there is no doubt you can create anything at lightning fast feeds!
Of course, recommendations are always appreciated inside the forum, if you would like some improvements. Folks at the academy, these are your passports to having lightning speed in the sky.
When you use these snippets with Sublime Text within HTML Files, or HTML within PHP, simply use the less than sign(<). As soon you start typing, it will display all the snippets. If it is directly within PHP itself, it should automatically show all of the Trongate Snippets as soon as you type.
Once the time is ripe, there are upcoming lessons, so stay tuned for that!
And for a more comprehensive view of the HTML snippets and ones I'm transferring to this Github account:
Smitty's Trongate Snippets in HTML
And thankfully, there is now a VSCode extension thanks to Simon and Jake:
Jake and Simon's VSCode Extension
Snippet Name | Shortcut | Syntax | Characters saved |
---|---|---|---|
Trongate Add Floating Cents Function (Two Variables Passed) | tgafc + <Tab> + your amount in dollars | number_format($your_amount, 2); |
15 |
Trongate Anchor Function | tga + <Tab> + your link | anchor('your_link') ; |
7 |
Trongate Class | tgc + <Tab> + Enter Your Classname + <Tab> + Enter your Class statements | class MyClass extends Trongate { Your code goes here. } |
25 |
Trongate Config Array Assignment | tgcaa + <Tab> + your first variable name + <Tab> + your second variable name | config[$your_variable1] = $your_variable2; |
8 |
Trongate Data Array Assignment | tgda + <Tab> + your array name + <Tab> + your function name | $your_arrayName = 'your_function_name'; |
2 |
Trongate Echo Current Url Function | tgecu + <Tab> Press <Tab> to move the cursor after the semicolon | echo current_url(your url); |
14 |
Trongate Echo Form Input Function | tgefi + <Tab> + form name + <Ctrl + Enter> | echo form_input('$form_name'); |
15 |
Trongate Echo Form Label Function | tgefl + <Tab> + your label + <Ctrl + Enter> | echo form_input('form_label'); |
14 |
Trongate Echo Form Submit Function | tgefs + <Tab> + <Ctrl + Enter> | echo form_submit('submit', 'Submit'); |
31 |
Trongate Form Textarea Function | tgeft + <Tab> + your text | echo form_textarea('your_text'); |
17 |
Trongate Form Close Function | tgfc + <Tab> | form_close(); |
8 |
Trongate Form File Select Function (Two Variables Passed) | tgffs + <Tab> + form name + <Tab> + form attributes | form_file_select('form_name', 'form_attributes'); |
18 |
Trongate Form File Select Function (Three Variables Passed) | tgffs3 + <Tab> + form name + <Tab> + form attributes + <Tab> + form additional code | form_file_select('form_name', 'form_attributes', 'form_additional_code'); |
18 |
Trongate Form Open Upload Function | tgfou + <Tab> + your form's location + <Tab> + the attributes + <Tab> + any additional code | form_open_upload($form_location, $attributes, $additional_code); |
20 |
Trongate Get Nice Date Class | tggnd + <Tab> | class TimeDate { function get_nice_date($timestamp, $format) { switch ($format) { case 'full': //FULL //Friday 18th of February 2011 at 10:00:00 AM $the_date = date('l jS \of F Y \a\t h:i:s A', $timestamp); break; case 'cool': //FULL // Friday 18th of February 2011 $the_date = date('l jS \of F Y', $timestamp); break; case 'shorter': //SHORTER // 18th of February 2011 $the_date = date('jS \of F Y', $time_stamp); break; case 'american': //AMERICAN // February 18th 2011 $the_date = date('F jS Y', $timestamp); break; case 'mini': //MINI // 18th Feb 2011 $the_date = date('jS M Y'), $timestamp); break; case 'oldschool': //OLDSCHOOL // 18/2/11 $the_date = ('j/n/y', $timestamp); break; case 'datepicker': //DATEPICKER // 18/2/11 $the_date = date('d/m/Y'), $timestamp); break; case 'datepicker_us': //DATEPICKER_US // 2/18/11 $the_date = date('m/d/Y', $timestamp); break; case 'dateandtimepicker': //DATEANDTIMEPICKER // 27th July 2018 - 03:50 pm $the_date = date('d F Y - H:i a', $timestamp); break; case 'monyear': //MONYEAR // 18th Feb 2011 $the_date = date('F Y', $timestamp); break; } return $the_date; } function _is_datepicker_valid($datepicker) { $datepicker_less_slashes = str_replace('/' '', $datepicker); $len = strlen($datepicker_less_slashes); if ((!is_numeric($datepicker_less_slashes)) or ($len !== 8)) { return FALSE; } else { return TRUE; } } function get_nice_date_from_datepicker($datepicker, $format) { $is_valid = $this->_is_datepicker_valid($datepicker); if ($is_valid == TRUE) { $timestamp = $this->make_timestamp_from_datepicker($datepicker); $nice_date = $this->get_nice_date($timestamp, $format); } else { $nice_date = '-'; } return $nice_date; } function make_timestamp_from_datepicker($datepicker) { $hour = 7; $minute = 0; $second = 0; $day = substr($datepicker, 0, 2); $month = substr($datepicker, 3, 2); $year = substr($datepicker, 6, 4); $timestamp = mktime($hour, $minute, $month, $day, $year); return $timestamp; } function make_timestamp_from_dateandtimepicker($dateandtimepicker) { $dateandtimepicker = str_replace('-', '', $dateandtimepicker); $timestamp = strtotime($dateandtimepicker); return $timestamp; } function make_timestamp_from_datepicker_us($datepicker) { $hour = 7; $minute = 0; $second = 0; $month = substr($datepicker, 0 ,2); $day = substr($datepicker, 3, 2); $year = substr($datepicker, 6, 4);> $timestamp = mktime($hour, $minute, $second, $month, $day, $year); return $timestamp; } function make_timestamp($day, $month, $year) { $hour = 7; $minute = 0; $second = 0; $timestamp = mktime($hour, $minute, $second, $month, $day, $year); return $timestamp; } }; |
2897 |
Trongate HTML BASE_URL | tghbu + <Tab> + Press <Tab> to move the cursor after the closing PHP tag | <?= BASE_URL ?> |
9 |
Trongate HTML Flash Data | tghfd + <Tab> | <?= flashdata() ?> |
12 |
Trongate HTML Validation Errors | tghve + <Tab> | <?= validation_errors(); ?> |
21 |
Trongate HTML Variable | tghv + <Tab> + Press <Tab> to move the cursor after the closing PHP tag | <?= $your_variable ?> |
3 |
Trongate Logic Expression | tgle + <Tab> + enter your value + Press <Tab> + enter your expression | your_variable = your_expression; |
-1 |
Trongate Logic If Else | tglie + <Tab> + enter your IF condition + Press <Tab> + enter the code inside the condition + Press <Tab> + enter the code for the else condition | `if (condition) { if-statements } else { else-statements } |
26 |
Trongate Logic If ElseIf | tglei + <Tab> + enter your IF condition + Press <Tab> + enter your code inside the condition + Press <Tab> + enter your ELSEIF condition + Press <Tab> + enter the code for the ELSEIF condition + Press <Tab> + enter your code for the ELSE condition | if (condition) { if-statements; } elseif (elseif-condition) { elseif-statements;} else { else-statements; } |
19 |
Trongate Method (No Variables Passed) | tgm + <Tab> + name your function + <Tab> to move the cursor to the method statements | function your_function() { Your method code goes here. } |
11 |
Trongate Method (One Variable Passed) | tgm1 + <Tab> + name your function + <Tab> + name of your variable to pass + <Tab> to move cursor to method statements | function your_function(your_variable) { Your method code goes here. } |
7 |
Trongate Method (Two Variables Passed) | tgm2 + <Tab> + name your function + <Tab> + name of your first variable to pass + <Tab> + name of your second variable to pass <Tab> to move cursor to method statements | function your_function(your_variable1, your_variable2) { Your method code goes here. } |
8 |
Trongate Method (Three Variables Passed) | tgm3 + <Tab> + name your function + <Tab> + name of your first variable to pass + <Tab> + name of your second variable to pass <Tab> + name of your third variable to pass + <Tab> to move cursor to method statements | function your_function(your_variable1, your_variable2, your_variable3) { Your method code goes here. } |
11 |
Trongate Model Delete Function | tgmd + <Tab> + number / id in table to delete + <Tab> + table name for deletion | $this->model->delete(id, 'tableName'); |
19 |
Trongate Model Get Function (Two Variables Passed) | tgmg + <Tab> + enter which way you want the model ordered by + <Tab> + your target table | $this->model->get('order_by', 'target_tbl'); |
16 |
Trongate Model Get Function (Three Variables Passed) | tgmg3 + <Tab> + enter which way you want the model ordered by + <Tab> + your target table <Tab> + your limit | $this->model->get('order_by', 'target_tbl', 'limit'); |
22 |
Trongate Model Get Function (Four Variables Passed) | tgmg4 + <Tab> + enter which way you want the model ordered by + <Tab> + your target table <Tab> + your limit + <Tab> + your offset | $this->model->get('order_by', 'target_tbl', 'limit', 'offset'); |