load non-class library |
[eluser]Unknown[/eluser]
I have a library called "lib.php" this is the content <?php function abc() { echo 'kkkk'; } ?> I tried $this->load->file to load the library with absolute and relative path the lib.php still not be loaded how to load this library properly?
[eluser]pbflash[/eluser]
Libraries need to be class files. See the user guide on creating your own libraries. http://ellislab.com/codeigniter/user-gui...aries.html
[eluser]Kristories[/eluser]
Code: class Example_lib{ Using Code: $this->load->library('example_lib');
[eluser]xerobytez[/eluser]
If you just need a few functions without a class then you should look into using a helper. http://ellislab.com/codeigniter/user-gui...lpers.html
[eluser]Unknown[/eluser]
[quote author="xerobytez" date="1331268916"]If you just need a few functions without a class then you should look into using a helper. http://ellislab.com/codeigniter/user-gui...lpers.html[/quote] now my library is work, but still have a problem to use the helper, the file name is required to change to xxx_helper.php but now I intent to use a library from internet https://github.com/openid/php-openid/downloads and use the example directly examples/consumer/try_auth.php so I think I should keep everything to be original (file name, code, structure) because I don't know what will be affected if I change it. |
Welcome Guest, Not a member yet? Register Sign In |