CodeIgniter Forums
how to call a function of a controler - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: how to call a function of a controler (/showthread.php?tid=19651)



how to call a function of a controler - El Forum - 06-14-2009

[eluser]aktosci[/eluser]
I have a controler
function index()
function f1()
{
..
}

Il would like to use this fonction1 in a second fonction

function f2()
{
..
f1()
..
}

How is the systax ? In normal php it works well but here I dupplicate my code. I don't use the benefit of CI.


how to call a function of a controler - El Forum - 06-14-2009

[eluser]TheFuzzy0ne[/eluser]
You'd need to prefix it with [/b]$this->[/b]:
Code:
$this->f2();



how to call a function of a controler - El Forum - 06-14-2009

[eluser]aktosci[/eluser]
Thank you it was what I was looking for.