• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Not load library in server, only in my notebook (localhost)

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

I have a little problem.

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

Library (CurrentMenu) - directory: libraries/CurrentMenu.php.
<?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:
function index() {
     $this->currentmenu->seAtual("home", "home", "current");            

But, appear this message (only in server, not in my notebook [localhost]):
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

[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.

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

I dont know my friend :-S

[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:
// 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.
$this->currentmenu->seAtual("home", "home", "current");

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.

Just guessing... it could be that you have Windows on your laptop (not case sensitive), and Linux on the server (case sensitive).

[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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.