Skip to content

Commit

Permalink
Added messages support, fixed db_conn snippet and added html table sn…
Browse files Browse the repository at this point in the history
…ippets
  • Loading branch information
mpmont committed May 25, 2020
1 parent cfe1447 commit 6a4834f
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Codeigniter 4 Snippets for Sublime Text 2/3

[![Codeigniter](https://img.shields.io/badge/Codeigniter-v4.0-orange.svg)](http://codeigniter.com/)

[![Downloads](https://packagecontrol.herokuapp.com/downloads/CodeIgniter%20Snippets.svg?color=80d4cd)](https://packagecontrol.io/packages/CodeIgniter%204%20Snippets)

This is a [Sublime Text][sublime] package which includes a bunch of handy snippets for doing Codeigniter 4 framework development.

### Easy installation ###
Expand Down Expand Up @@ -60,6 +62,9 @@ If you find error or whatever just fork it and send me a pull request.
| ci_getcache | Grab an instance of the cache engine directly through the Services class |
| ci_email | Basic example demonstrating how you might send email |
| ci_email_config | Basic email Preferences |
| ci_html_table | Create a basic html table based in a given array |
| ci_query_table | Create a basic html table based in query result |
| ci_table_template | Set your basic html table layout |

# Contributors

Expand Down
15 changes: 15 additions & 0 deletions ci4_html_table.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<snippet>
<content><![CDATA[
\$table = new \CodeIgniter\View\Table();
\$data = [
['Name', 'Color', 'Size'],
['Fred', 'Blue', 'Small'],
['Mary', 'Red', 'Large'],
['John', 'Green', 'Medium'],
];
echo \$table->generate(\$data);
]]></content>
<tabTrigger>ci_html_table</tabTrigger>
<scope>source.php</scope>
<description>CI4 - The Table Class provides methods that enable you to auto-generate HTML tables</description>
</snippet>
10 changes: 10 additions & 0 deletions ci4_query_table.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<snippet>
<content><![CDATA[
\$table = new \CodeIgniter\View\Table();
\$query = $db->query('SELECT * FROM my_table');
echo \$table->generate($query);
]]></content>
<tabTrigger>ci_query_table</tabTrigger>
<scope>source.php</scope>
<description>CI4 - Table created from a database query result</description>
</snippet>
43 changes: 43 additions & 0 deletions ci4_table_template.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<snippet>
<content><![CDATA[
\$template = [
'table_open' => '${1:<table border="0" cellpadding="4" cellspacing="0">}',
'thead_open' => '${2:<thead>}',
'thead_close' => '${3:</thead>}',
'heading_row_start' => '${4:<tr>}',
'heading_row_end' => '${5:</tr>}',
'heading_cell_start' => '${6:<th>}',
'heading_cell_end' => '${7:</th>}',
'tfoot_open' => '${8:<tfoot>}',
'tfoot_close' => '${9:</tfoot>}',
'footing_row_start' => '${10:<tr>}',
'footing_row_end' => '${11:</tr>}',
'footing_cell_start' => '${12:<td>}',
'footing_cell_end' => '${13:</td>}',
'tbody_open' => '${14:<tbody>}',
'tbody_close' => '${15:</tbody>}',
'row_start' => '${16:<tr>}',
'row_end' => '${17:</tr>}',
'cell_start' => '${18:<td>}',
'cell_end' => '${19:</td>}',
'row_alt_start' => '${20:<tr>}',
'row_alt_end' => '${21:</tr>}',
'cell_alt_start' => '${22:<td>}',
'cell_alt_end' => '${23:</td>}',
'table_close' => '${24:</table>}'
];
\$table->setTemplate($template);
]]></content>
<tabTrigger>ci_table_template</tabTrigger>
<scope>source.php</scope>
<description>CI4 - Set a table template with which you can specify the design of your layout</description>
</snippet>
3 changes: 2 additions & 1 deletion ci_db_conn.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<snippet>
<content><![CDATA[
\$db = \Config\Database::connect();
\$builder = $db->table('${1:table_name}');
]]></content>
<tabTrigger>ci_db_connr</tabTrigger>
<tabTrigger>ci_conn</tabTrigger>
<scope>source.php</scope>
<description>CI4 - Create a new database connection</description>
</snippet>
5 changes: 5 additions & 0 deletions messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"install": "messages/install.txt",
"1.0.20": "messages/1.0.20.txt",
"1.0.24": "messages/1.0.24.txt"
}
7 changes: 7 additions & 0 deletions messages/1.0.20.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Added some more codeigniter 4 snippets to our repo

ci_entity - Create a new Entity class
ci_cache - Save into the cache for x minutes
ci_getcache - Grab an instance of the cache engine directly through the Services class
ci_email - Basic example demonstrating how you might send email
ci_email_config - Basic email Preferences
9 changes: 9 additions & 0 deletions messages/1.0.24.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
1.0.24

- Added messages
- Added html table
+ ci_html_table - Create a basic html table based in a given array
+ ci_query_table - Create a basic html table based in query result
+ ci_table_template - Set your basic html table layout
- Fixed ci_db_conn snippet
- Updated readme file
10 changes: 10 additions & 0 deletions messages/install.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
This is a Sublime Text package which includes a bunch of handy snippets for doing Codeigniter 4 framework development.

If you find any problems please submit a pull request to: https://github.com/mpmont/ci4-snippets

Have any snippets for codeigniter 4 in your sublime install? Submit them here: https://github.com/mpmont/ci4-snippets

Thanks to all our contributors:

- Marco Monteiro
- haerunn

0 comments on commit 6a4834f

Please sign in to comment.