[eluser]mzvasiq[/eluser]
I created a Custom Library and saved it in application/libraries folder. But when i try to load the library from the Controller using the following code.
Code:
$this->load->library('BlogUtilities');
It just doesn't get loaded, so after checking the CodeIgniter's log file I came to know it's giving 'No direct script access allowed'
I don't understand why am i getting this error.
My Library has only two functions in it.
[eluser]scornaky[/eluser]
Check:
file name it is in
libraries folder
filename is
BlogUtilities.php
class name is
BlogUtilities
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class BlogUtilities
{
public function test()
{
echo "time now".time();
}
}
call
Code:
$this->load->library('BlogUtilities');
$this->blogutilities->test();
[eluser]mzvasiq[/eluser]
Ya it's exactly the same, i crossed checked everything. I don't know why I'm still getting that error.
There's no .htaccess file in the folder, is it due to that ?
[eluser]scornaky[/eluser]
in libraries?
I don`t have this kind of thing there

.
But.. i`m saying again : filename is .php ? Not "BlogUtilities.php.txt"
Take a look in your host or in windows : view extension
"blogutilities" name is lowercase ? - in call
[eluser]mzvasiq[/eluser]
Yea filename is in .php extension.
And yes even the Filename is being called correctly....
[eluser]scornaky[/eluser]
make a test: use in autoload
Code:
$autoload['libraries'] = array('blogutilities'); //to check
then call
Code:
$this->blogutilities->test();
is working?
[eluser]mzvasiq[/eluser]
I had tried that too... even that's not working
In the log it says
Code:
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]scornaky[/eluser]
[quote author="mzvasiq" date="1381324972"]I had tried that too... even that's not working
In the log it says
Code:
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[/quote]
what you type in URL in browser?
[eluser]mzvasiq[/eluser]
I don't type anything in the browser. There's a function in my Controller which loads this Library and calls the function directly.
[eluser]scornaky[/eluser]
yes

...
And your controller extend extends CI_Controller ?
Code:
class MY_Controller extends CI_Controller { }
or try this:
Code:
$this->CI =& get_instance();
$this->CI->load->library('blogutilities');