-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: improve helpers #8294
docs: improve helpers #8294
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This explanation is good.
But what makes documents simple and fluent is the existence of examples in the document. I think creating a title with "creating custom helper" and a simple example is good for improving the documentation.
<?php
// app/Helpers/info_helper.php
use CodeIgniter\CodeIgniter;
if (!function_exists('getVer')) {
function getVer()
{
return CodeIgniter::CI_VERSION;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's clear to me how you can create a helper
It is not a method, but a function.
Added a custom helper code. |
*/ | ||
function ci_version(): string | ||
{ | ||
return CodeIgniter::CI_VERSION; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return CodeIgniter::CI_VERSION; | |
return CodeIgniter\CodeIgniter::CI_VERSION; |
OR use CodeIgniter\CodeIgniter;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kenjis.
Description
From https://forum.codeigniter.com/showthread.php?tid=88591&pid=414184#pid414184
Checklist: