Hello Everyone,
I am using CI 4.0.4
XAMPP CONTROL 3.2.4
I AM USING CI 4.0.4 FOR MY ONGOING LIVE PROJECT
CURRENTLY I AM FACING SOME ISSUE
I HAVE CREATED LIBRARIES
in basecontroller.php
in products.php controller
How i can i access libraries Check_operation in above products view file
view file of products.php
i taught of using
but it giving me ArgumentCountError 0
in ci3
we can use directly in view
like
but ci4 - cant
please let me know
I am using CI 4.0.4
XAMPP CONTROL 3.2.4
I AM USING CI 4.0.4 FOR MY ONGOING LIVE PROJECT
CURRENTLY I AM FACING SOME ISSUE
I HAVE CREATED LIBRARIES
Code:
<?php
namespace App\Libraries;
use CodeIgniter\HTTP\RequestInterface;
class Product
{
protected $session;
protected $obj;
private $module;
function __construct($one,$two) {
helper(['html', 'url', 'form']);
$this->obj = $this;
$this->session = \Config\Services::session();
$this->session->start();
$this->module = $this->session->get('modulevalue');
}
function Check_operation($final,$operation)
{
if(isset($this->obj->module[$final][$operation]))
return 1;
else
return 0;
}
}
in basecontroller.php
Code:
protected $libcon;
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
$this->libcon= new Product($one,$two);
}
in products.php controller
Code:
<?php namespace App\Controllers;
class Products extends BaseController
{
public function recentPosts()
{
$data = [];
echo view('templates/header', $data);
echo view('products'); // here in above products view file i need to access libraries Check_operation , and this i have to used in multiple view files
echo view('templates/footer');
}
}
How i can i access libraries Check_operation in above products view file
view file of products.php
i taught of using
Code:
<?= view_cell('\App\Libraries\Product::Check_operation', ['4' , '7']) ?>
but it giving me ArgumentCountError 0
in ci3
we can use directly in view
like
Code:
<?php $this->libcon->Check_operation(4,7) ;?>
but ci4 - cant
please let me know