File tree Expand file tree Collapse file tree
user_guide_src/source/general Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -172,9 +172,17 @@ URI to the controller/method you wish to link to.
172172Creating Helpers
173173****************
174174
175+ Creating Custom Helpers
176+ =======================
177+
175178The helper filename is the **helper name ** and **_helper.php **.
176- For example, to create Email Helper, you’ll create a file named
177- **app/Helpers/email_helper.php **.
179+
180+ For example, to create info helper, you’ll create a file named
181+ **app/Helpers/info_helper.php **, and add a function to the file:
182+
183+ .. literalinclude :: helpers/008.php
184+
185+ You can add as many functions as you like to a single helper file.
178186
179187"Extending" Helpers
180188===================
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ // app/Helpers/info_helper.php
4+
5+ /**
6+ * Returns CodeIgniter's version.
7+ */
8+ function ci_version (): string
9+ {
10+ return CodeIgniter::CI_VERSION ;
11+ }
You can’t perform that action at this time.
0 commit comments