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

[eluser]Gijs Bloemen[/eluser]
Hi all,

Can you call also your plugins in your controller instead of in your view? Because in the user guide they say when you want to use a function defined in a plugin. You have to load that plugin and use de functionname of the function u want to use like you would do when it was normal PHP. In the example they call that function in the view (the anchor function, yes it is in the helper user guide but in the plugin user guide they say that it works exactly the same as the helpers).

Regards,
Gijs Bloemen

(Sorry for mij bad English)
#2

[eluser]bigtony[/eluser]
Yes, you would nearly always use plugins in a controller, like this:
Code:
$this->load->plugin('calculator');
$sum = add(2, 3);
The above assumes a plugin in your 'plugins' directory called 'calculator_pi.php' containing something like this:
Code:
function add($num1, $num2) {
    return $num1 + $num2;
}
#3

[eluser]Gijs Bloemen[/eluser]
Ok, thanks. It didn't work over here. But now I see what I did wrong. I putted my functions first in a class like in the libraries dir..




Theme © iAndrew 2016 - Forum software by © MyBB