Welcome Guest, Not a member yet? Register   Sign In
Custom Library Problem with using outside of application
#1

[eluser]Unknown[/eluser]
I have a submit form outside of my application folder in a psuedo /bin/ folder. I tried to create a custom librariy to allow access to my model. I cannot seem to get the library to load. It might not be a bug because most likely codeignitor core is only accessible to files within the application path idk. I could just call submit from the controller but I'm not sure if this is the standard was to do it.

call from submit.php
Code:
$this->load->library("mylib");

library in the application/libraries folder
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Mylib {

     public function set_photo_pos($section,$oldpos,$newpos)
     {
        $CI =& get_instance();
        
        $CI->load->model('home_model');
        return $CI->home_model->set_photo_pos($section,$oldpos,$newpos);
     }
}

/* End of file mylib.php */
#2

[eluser]XMadMax[/eluser]
Hey codecamper, if you want to load a library inside a directory, ex: /libraries/bin, you must to have a loader inside libraries directory.

/libraries/Mylib.php:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

include ",/bin/Mylib.php";

And the class must to be the same name as the loader file.




Theme © iAndrew 2016 - Forum software by © MyBB