CodeIgniter Forums
Can't call a function in view file - 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: Can't call a function in view file (/showthread.php?tid=5090)



Can't call a function in view file - El Forum - 01-05-2008

[eluser]Isos[/eluser]
Hello .. I am receiving a fatal error and I understand that there is something to be done to avoid it, it's when I created a function inside the file's class in controller called __get_time_difference() and called it only inside the view file:

Fatal error: Call to undefined method CI_Loader::__get_time_difference() in /Natalisushka/srv/www/UnderConstruction/client-core.com/kernel/application/views/CustomWritings/orders_view.php

How can I define method CI_Loader::__get_time_difference() ?

Thanks


Can't call a function in view file - El Forum - 01-05-2008

[eluser]Grahack[/eluser]
You'd better move this function to a helper, that's what they are here for! See the docs about helpers.


Can't call a function in view file - El Forum - 01-05-2008

[eluser]Isos[/eluser]
I thought about that, anyway, thanks for the tip.