• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ancillary Classes in CI4

#1
i am troubling in  call function in My_helper.php  CI4
i can't  call function in helper page , and cannot connect with Model with    $CI =& get_instance(); 
its is showing error, please help ...
how to call  $CI =& get_instance();  in CI 4
Reply

#2
There is no CI 4 get_instance like CI 3 it's all OOP now.

Helpers are load by an array anywhere or by the array in the BaseController.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(07-29-2020, 02:58 AM)InsiteFX Wrote: There is no CI 4 get_instance like CI 3 it's all OOP now.

Helpers are load by an array anywhere or by the array in the BaseController.
How to call the controller function or model function inside a  particular helper function?

function allcustomers($x)
{
$ci =& get_instance();
$customer_datas=$ci->invoice_model->getallcustomers($x);
echo "<select id='customer' name='customer' class='form-control required' required>";
echo '<option value="">Please Select</option>';
foreach($customer_datas as $listcustomer)
{
echo "<option value='$listcustomer[customer_id]'>$listcustomer[customer_name]</option>";
}
echo "</select>";
}
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.