Welcome Guest, Not a member yet? Register   Sign In
How to call function from custom helper ?

On codeigniter 4.3.7 site I need to create a custom helper so I created a file app/Helpers/helper.php with code:

PHP Code:

namespace App\Helpers;

DATE_FORMAT '%B %d, %Y';

formatDateTime($DateTimeLabel ''$format '')

I try to call this method from view file app/Views/admin/categories/index.php:

PHP Code:
<?php helper('helper'); ?>
<?= $this

<?= $this->section('content'?>

<td><?= formatDateTime($category['created_at'], "ASTEXT"?></td> 

But I got error that function formatDateTime not found even after in app/Config/Autoload.php I added ref to my helper file :

PHP Code:
public $helpers = [

Have I to run some console commands to use my helper ?

Thanks in advance!

Messages In This Thread
How to call function from custom helper ? - by petrogromovo - 10-02-2023, 07:22 AM

Theme © iAndrew 2016 - Forum software by © MyBB