Welcome Guest, Not a member yet? Register   Sign In
Calendar class problem
#1

Hi everyone,

Im working with codeigniter for a while and can fix most problems myself. Now I stubled on a problem where I am not sure what the problem really is. I am trying to load the calendar class to generate a calendar. I auto-loaded the class, loaded in the controller's construction method, and tried to load it in the controllers method where I use it. Nothing seems to work because I get this error everytime:

Call to undefined method Calendar::generate()

When I check if the calendar class is loaded it returns a false... I have no idea what the problem is. I did not alter any codeigniter system functions and the class is in the normal directory.

Did anyone had this problem before or understands whats going on here?
Reply
#2

Hm, normaly it should work like this:

PHP Code:
$this->load->library('calendar');
echo 
$this->calendar->generate(); 

Is this what you did?

Reply
#3

yes, I used the example code from the CodeIgniter User Guide Version 2.2.0. I am running this version. This is the first time I tried the calendar class, but it doesnt work with the example code. I am running it local on WAMP.

The exact error is:

( ! ) Fatal error: Call to undefined method Calendar::generate() in C:\wamp\www\XXX\application\controllers\admin.php on line 104
Call Stack
# Time Memory Function Location
1 0.0014 258408 {main}( ) ..\index.php:0
2 0.0038 316416 require_once( 'C:\wamp\www\XXX\system\core\CodeIgniter.php' ) ..\index.php:202
3 0.1362 3380352 call_user_func_array:{C:\wamp\www\XXX\system\core\CodeIgniter.php:359} ( ) ..\CodeIgniter.php:359
4 0.1362 3380480 Admin->bla( )
Reply
#4

trip3nd please provide us with your code.. we can't just guess what is the problem..
Best VPS Hosting : Digital Ocean
Reply
#5

I thought I explained clear enough...

Well I am using the exact same code as the userguide example:

$this->load->library('calendar');
echo $this->calendar->generate();

And this does not seem to work. The library isnt loaded and because of that the error indicates that the calendar->generate method doesnt excist.....
Reply
#6

(This post was last modified: 11-25-2014, 08:25 AM by sv3tli0.)

(11-25-2014, 07:20 AM)trip3nd Wrote: I thought I explained clear enough...

Well I am using the exact same code as the userguide example:

$this->load->library('calendar');
echo $this->calendar->generate();

And this does not seem to work. The library isnt loaded and because of that the error indicates that the calendar->generate method doesnt excist.....


Do you have any model/library or other class loaded with the same name calendar ? 
Some times such name duplication can fuck you up..

You can var_dump($this->calendar) just to be sure that this is the required Library class.
Best VPS Hosting : Digital Ocean
Reply
#7

Just for fun .. can you include the timezone in the /index.php of your document root like that (e.g. for germany)

PHP Code:
try one of them

if(!ini_get('date.timezone')) { date_default_timezone_set('GMT'); }
#if (function_exists('date_default_timezone_set')) { date_default_timezone_set('Europe/Berlin'); } 

This is done in CI3. Maybe it helps you for your WAMP environment

Reply




Theme © iAndrew 2016 - Forum software by © MyBB