Creating own library |
[eluser]fuksito[/eluser]
Tell me where am I going wrong: I`ve created file <b><i>application/libraries/Comment.php</i></b> with content: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); In my controller I load library and call it`s method Code: function index($id) But I get an error: Call to a member function comments() on a non-object
[eluser]BeingDefined[/eluser]
A wild guess here but try removing the "public" keyword from the comments function. Also try changing "function index($id)" to "function index()"
[eluser]fensen[/eluser]
Please try changing: Code: $this->Comment->comments(); Code: $this->comment->comments(); According to CI documentation: Quote:Once loaded you can access your class using the lower case version http://ellislab.com/codeigniter/user-gui...aries.html Hope this helps.
|
Welcome Guest, Not a member yet? Register Sign In |