Welcome Guest, Not a member yet? Register   Sign In
[Solved] Not load library in server, only in my notebook (localhost)
#1

[eluser]Patrick Maciel | @p4designer[/eluser]
Hi everbody.
(Sorry about my english, I'm brazilian)

I have a little problem.

Autoload:
Code:
$autoload['libraries'] = array('currentmenu');


Library (CurrentMenu) - directory: libraries/CurrentMenu.php.
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class CI_CurrentMenu {
    
    function seAtual($body_id, $body_id_atual, $classe) {
        if( $body_id == $body_id_atual ) {
            echo $classe;
        }
    }
    
}

?>
I try too rename class to only CurrentMenu not CI_CurrentMenu, but, not sucess.


Here, I call/load the library:
Code:
function index() {
     $this->currentmenu->seAtual("home", "home", "current");            
}

But, appear this message (only in server, not in my notebook [localhost]):
Code:
An Error Was Encountered
Unable to load the requested class: currentmenu



What's the problem? I no have idea :-S
Help me please!


So... thanks so much Smile
#2

[eluser]Cesar Kohl[/eluser]
This is unusual.

Is there a duplicate name for 'currentmenu'? I had some months ago the same problem but in both, local and remote, servers and the problem was two duplicate names conflicting.
#3

[eluser]Patrick Maciel | @p4designer[/eluser]
Ya, ok.... but: where the duplicate name in the adove the code?

I dont know my friend :-S
#4

[eluser]Patrick Maciel | @p4designer[/eluser]
I found a solution!
I think for load the library you need write name in "lower case", but, NOT!

When I change the autload.php for:
Code:
// Now works :)
$autoload['libraries'] = array('CurrentMenu');

// This below, not work for me
$autoload['libraries'] = array('currentmenu');

So.... to load a library in CodeIgniter 1.7.2, you must enter the library name like the name of the class - class NameHere - "capitalize."

BUT... for use the library functions you need write library name in lower case.
Code:
$this->currentmenu->seAtual("home", "home", "current");


Observations:
In my note (localhost), PHP version is 5.3.1, and in server/host is 5.2.6.
I guess it was not the problem but not sure.
Why, anyway, on my laptop works the "autoload" in "lower case" but not on the server.


I hope I have helped someone with this.
now, grateful for the support.
#5

[eluser]gyo[/eluser]
Just guessing... it could be that you have Windows on your laptop (not case sensitive), and Linux on the server (case sensitive).
#6

[eluser]Patrick Maciel | @p4designer[/eluser]
[quote author="gyo / suashi" date="1292277912"]Just guessing... it could be that you have Windows on your laptop (not case sensitive), and Linux on the server (case sensitive).[/quote]

Oh,I dont know O_O.
Thanks so much my friend Smile

I just use in 'lower case' because in User Guide it's in 'lower case', but ok.
Thanks my friend Smile




Theme © iAndrew 2016 - Forum software by © MyBB