Include a extern php 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: Include a extern php file... (/showthread.php?tid=1980) |
Include a extern php file... - El Forum - 07-09-2007 [eluser]Unknown[/eluser] Hi.. I´m trying to include a extern php file, I received no error messages em I use this: include(base_url().'public/includes/funcoes.php'); The path exists and the file is there! but when I try to access a method function of the file 'funcoes.php' I got the php error: Fatal error: Call to undefined function ConverteDataBR() in C:\projetos\web\ci\system\application\views\busca.php on line 32 Somebody can reply me? Thanks... Include a extern php file... - El Forum - 07-09-2007 [eluser]Unknown[/eluser] I don´t know if it is right but I used this topic [http://ellislab.com/forums/viewthread/55212/] to resolve this... So, I created a file named funcoes_helper.php on the /helpers and called in the VIEW file with Code: $this->load->helper('funcoes' ); Is it right? see ya... Include a extern php file... - El Forum - 07-09-2007 [eluser]Rick Jolly[/eluser] [quote author="Troian" date="1184036478"] I´m trying to include a extern php file, I received no error messages em I use this: include(base_url().'public/includes/funcoes.php'); [/quote] Use the constant APPPATH instead of base_url(). When you include a php file using the url through http, the file will be executed and the result will be included. That is not normally what you'd want. However, using a helper as you have (or a library) is the CI way to include functions and classes. You can call the functions in the view, but it is probably best to load the helper in the controller. Include a extern php file... - El Forum - 07-09-2007 [eluser]Colin Williams[/eluser] Sounds like you have a file with a class defined in it, and you're including the file, but not instantiating the class. Just put it in the Library folder and you've got a library. |