Loading custom library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Loading custom library (/showthread.php?tid=59468) Pages:
1
2
|
Loading custom library - El Forum - 10-09-2013 [eluser]noideawhattotypehere[/eluser] This is how i load my custom google analytics library: $this->load->library('analyticsapi'); ./application/libraries/analyticsapi.php [notice its lowercase! it didnt work when it was uppercase] class AnalyticsApi { //rest of the code. Loading custom library - El Forum - 10-09-2013 [eluser]mzvasiq[/eluser] Still I get the same error .. Severity: Notice --> Undefined property: Login_Controller::$BlogUtilities /Applications/MAMP/htdocs/MzBlog/application/controllers/login_controller.php 21 Line no 21: Is calling a function And yeah the Library file name is written in the format according the CodeIgniter's rule.... Loading custom library - El Forum - 10-09-2013 [eluser]davidMC1982[/eluser] In the log, does it actually say: Code: if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Or Code: No direct script access allowed If the former, then your library file is probably not being parsed as php. Maybe you've missed the opening <?php tag or your file name is acutally *.php.* If in Windows, remove the tick from "Hide extensions for known filetypes" in your folder options. If it's not these two things, then you should post the complete controller and library code. You're asking us to hit an invisible target otherwise. If it displays the latter ('No direct script access allowed') then your code has somehow unset the BASEPATH constant or you're not calling it through the framework. Again, we'd need to see the code to have any idea of how this may have occurred. Loading custom library - El Forum - 10-09-2013 [eluser]mzvasiq[/eluser] Ok this is the code for BlogUtilities.php. And regarding the file extension i'm using Mac so the Type of file says 'Php' BlogUtilities.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Login_Controller.php Code: class Login_Controller extends CI_Controller{ And yeah the exact Error which i'm getting in the Log file is this .... Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?> Line No 21 being loading the BlogUtilities.php file Loading custom library - El Forum - 10-09-2013 [eluser]scornaky[/eluser] Code: $this->blogutilities->f1(); Quote:Once loaded you can access your class using the lower case version: Code: $hash_pass = $this->blogutilities->generate_hash($password); Loading custom library - El Forum - 10-09-2013 [eluser]mzvasiq[/eluser] Oh finally... it got solved Thanks a lot all of you for your help.... Loading custom library - El Forum - 10-09-2013 [eluser]scornaky[/eluser] to say or not to say Have u read my first post? |