Тёмный

#15 Custom View Filters in CodeIgniter 4 

GoPHP
Подписаться 4,4 тыс.
Просмотров 8 тыс.
50% 1

Опубликовано:

 

25 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 18   
@foxbille
@foxbille 4 года назад
Very interesting ! Thank you, this helps a lot ! but what if a new version of CI4 is coming ? every thing will be lost. Like we used to do in CI3 for models, isn't it possible to put the new custom filter in a file located in app/ directory and named MY_Filters ... so that it can "survive" to further CI upgrades ? Eric
@GoPHP
@GoPHP 4 года назад
Yes, we can keep our filters into a separate folder, it is possible 1.create folder with name Viewfilters or MY_Filters in App folder: \App\Viewfilters 2. create class with name Filters and save it in Viewfilters folder. find the code below namespace App\Viewfilters; class Filters { public static function hideNumbers(string $value, int $display = 4): string { $txt = ''; for($i = 0; $i < strlen($value); $i++) { if($i < $display) { $txt .= $value[$i]; } else { $txt .= "X"; } } return $txt; } } 3. open view.php from the location App\Config\View.php and find the array public $filters = [ ] please update the path of your filter here like: public $filters = [ 'hidenumbers' => '\App\Viewfilters\Filters::hideNumbers', 'someother' => '\CodeIgniter\View\Filters::countVowels', ]; 4. in view file apply your filter Mobile: {mobile|hidenumbers(4)} Save all the work and please check I will prepare a small video for this and I'm going to update here Thank You Eric
@foxbille
@foxbille 4 года назад
@@GoPHP Work fine !!!! You're fabulous, thank you very very much.
@JogeshKrishna
@JogeshKrishna 3 года назад
@@GoPHP you are awesome:) works like magic..
@TheSoftwareServices
@TheSoftwareServices 4 года назад
Great teaching sir, pl do Core PHP and OOPS Inheritance,Polymorphism, Abstraction, Encapsulation, Overidding Overloading....etc, it will be helpful to many.....
@GoPHP
@GoPHP 4 года назад
Sure , GoPHP is planning the same
@kprakash9665
@kprakash9665 2 года назад
SYSTEM FILE IS not generated if i install with composer installation command What is an alternate Option for it brother
@softwareEngineerKunwar
@softwareEngineerKunwar 3 года назад
thank you for your video.
@vijaysrini27
@vijaysrini27 4 года назад
When how do you pass more than two variables in a filter. E.g you showed how to display 6 digits. But suppose, we want to display 6 digits and the remaining with a '*' instead of an 'X' (which should be our choice dynamically), how do we do that?
@GoPHP
@GoPHP 4 года назад
Vijay, I have checked the manual and other resources as well, as of now I found, we can pass one parameter only, like: hidenumbers(2). if I found any, I'll update you Vijay
@vijaysrini27
@vijaysrini27 4 года назад
@@GoPHP Thanks.
@kulasiriniit
@kulasiriniit 4 года назад
Sir System Folder is not in my folder structurer in ci4 how can i setup that?. Simply can we Copy and past sytem folder from the Original Downloaded folder. is it correct way
@GoPHP
@GoPHP 4 года назад
how did you install? Manual or Composer if you did composer installation, no need to download system folder. it will available in C:\xampp\htdocs\Project\vendor\codeigniter4\framework if you did manual installation, System folder will download automatically please check...
@nipunsachinda
@nipunsachinda 3 года назад
@@GoPHP 'hideNumbers' => '\CodeIgniter\View\Filters::hideNumbers' mothod is not found in directory.i used composer install.how do I change
@aaniqchagani5844
@aaniqchagani5844 3 года назад
@@GoPHP Thanks
@JogeshKrishna
@JogeshKrishna 3 года назад
@@GoPHP Yup I made the required changes in C:\xampp\htdocs\Project\vendor\codeigniter4\framework it works
@jasshhandrews1022
@jasshhandrews1022 3 года назад
HI Gophp, When I'm trying to pass variable as 6 in hidenumbers it is showing complete mobile number, it is not hiding last 6 numbers public function hideNumber(string $value, int $display = 4): string { $txt = ''; for($i = 0; $i
@kulasiriniit
@kulasiriniit 4 года назад
Thank you so much sir
Далее
#16 View Layouts CodeIgniter 4
30:18
Просмотров 13 тыс.
Гаджет из даркнета 📦
00:45
Просмотров 188 тыс.
Только ЕМУ это удалось
01:00
Просмотров 816 тыс.
Product Filters in Codeigniter using Ajax - 1
15:50
Просмотров 28 тыс.
7 - Model View Controller MVC | CodeIgniter 3 Tutorial
31:59
#6. Implementing Admin Forgot Password in CodeIgniter 4
31:43
Гаджет из даркнета 📦
00:45
Просмотров 188 тыс.