Welcome Guest, Not a member yet? Register   Sign In
Creating custom autoloading paths
#1

Hey Guys,

I have created a folder in the application folder called "includes"

I then tried to create the following custom auto loading path in the autoload.php ..

PHP Code:
$autoload['includes'] = array('pathtofile'); 

But i wasn't able to invoke the functions in the file I tried autoloading. Is it just the defaults that I can only autoload?? Thanks!
Reply
#2

I assume you're talking about the autoload config file? If that's the case, then no, you can't just add a new entry to it and hope it works since CodeIgniter itself doesn't know anything about it at that point.

I think what you're looking for is probably to use application packages which allows you to load your own models, libraries, etc from that path. It doesn't work well with simple class files that aren't in a libraries folder, for example.

Another option is to setup PSR4 autloading or classmaps if you're using Composer in your project already.
Reply
#3

Okay. Thanks!!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB