Welcome Guest, Not a member yet? Register   Sign In
Class
#1

How to load another class method from a different class?
Thanks
Reply
#2

(09-10-2018, 01:26 AM)frankenestain Wrote: How to load another class method from a different class?
Thanks
what do you mean with class?
library, controller, model?
Reply
#3

Perhaps this?
https://www.codeigniter.com/user_guide/g...ur-library

It's not limited to just CI resources, you can call your own libraries and methods using the same instance.
Reply
#4

I'm not sure, but if you have logic that you wish to use across different controllers, perhaps you should put that inside a model. That way you can access that logic from any controller.
Practical guide to IgnitedCMS - Book coming soon
Reply
#5

Let's say you have a library called Assets.php (in the application/libraries folder), and this class has a method called create_header() which returns a string.

In your controller:
PHP Code:
$this->load->library('assets');
$hdr $this->assets->create_header(); 

Is this the information you were looking for?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB