Lot of times i have put new my class in codeigniter, hepler, but now i have some problem, on server i got error 500? I dont know why.

This is class I want to implement in CI

Magic Minifier

MagicMin is a PHP based javascript and stylesheet minification and merging class.

http://www.phpclasses.org/browse/file/46461.html

I done everything and put in CI helper made construct, but on view when i try to call that object i got error 500, and no error log in server?

Can someone help me to do that, i have made it to work but i put class outside of CI, and done include, and working ok, but i dont want that, i want to have my view, clean :)

When i do something like this in controller

function __construct()
    {
        parent::__construct();  

        require( './application/third_party/class.magic-min.php' );
        $vars = array( 
            'encode' => true, 
            'timer' => true, 
            'gzip' => true, 
            'closure' => true);
        $data->minified = new Minifier( $vars );

    }

It is working but i dont want to have require in construct?

有帮助吗?

解决方案

$this->load->add_package_path()

Adding a package path instructs the Loader class to prepend a given path for subsequent requests for resources. As an example, the "Foo Bar" application package above has a library named Foo_bar.php. In your controller, you'd do the following:

$this->load->add_package_path(APPPATH.'third_party/foo_bar/');
$this->load->library('foo_bar');

http://ellislab.com/codeigniter/user-guide/libraries/loader.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top