• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to call my function into plugin?

#1
[eluser]suba[/eluser]
Hi all,

I created one function into my model.
Code:
class Mymodel extends Model
{
function Mymodel()
{
parent::Model();
}
function myfunction()
{
---------------
}
}
Normally we call
Code:
$this->mymodel->myfunction();// like this. but how do i call inside plugin?
Now I want to call myfunction function into my plugin.
how can i call this function into my plugin?
pls advice me.

Thanks.

#2
[eluser]mddd[/eluser]
In plugins en helpers, you must first get a reference to the CodeIgniter object. Then you can call that object in stead of '$this'.
Code:
$CI =& get_instance();
$CI->mymodel->myfunction();

However helpers and plugins are mostly meant for providing simple functions that don't need to reference models etc.
If you need access to your model, you might as well put the "plugin" function inside your model!

#3
[eluser]suba[/eluser]
Hi ,

Thanks to you.

thanks for immediate reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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