Welcome Guest, Not a member yet? Register   Sign In
public function __construct()
#3

(This post was last modified: 01-16-2024, 01:47 PM by adimancifi.)

I hope this work for you.

CodeIgniter v3.x
PHP Code:
class Home extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        
        $this
->load->model('youth_user_model');
        $this->load->helper('url');
        $this->load->helper('html');
    }
    
    
public function index()
    {
        return $this->load->view('home');
    }




CodeIgniter v4.4.4

PHP Code:
namespace App\Controllers;

use 
Config\Services;
use 
CodeIgniter\HTTP\CLIRequest;
use 
CodeIgniter\HTTP\IncomingRequest;
use 
CodeIgniter\HTTP\RequestInterface;
use 
CodeIgniter\HTTP\ResponseInterface;
use 
Psr\Log\LoggerInterface;

class 
Home extends BaseController 
{
    public function initController(RequestInterface $requestResponseInterface $responseLoggerInterface $logger)
    {
        parent::initController($request$response$logger);
        
        $this
->youth_user_model model('youth_user_model');
        helper(['url','html']);
    }
    
    
public function index()
    {
        return view('home');
    }

Reply


Messages In This Thread
public function __construct() - by Knutsford - 01-16-2024, 10:34 AM
RE: public function __construct() - by InsiteFX - 01-16-2024, 11:35 AM
RE: public function __construct() - by adimancifi - 01-16-2024, 01:08 PM
RE: public function __construct() - by kenjis - 01-16-2024, 01:52 PM
RE: public function __construct() - by Knutsford - 01-17-2024, 01:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB