Issue to initialize Bastian's calendar


I’m trying to do a front-end calendar and @bastianallgeier calendar seems to be fit for what I plan.

But when I try to initialize it by doing this :


I get that :
Fatal error: Cannot declare class Calendar, because the name is already in use in calendar.php on line 213

Did someone pass through this ?

Where have you put the files and where do you require the file?

I think the easiest way would be to put the files into /site/plugins/calendar/ so that it gets loaded automatically.

In your controller/template, you can then instantiate a new object:

$calendar = new Calendar();
echo $calendar->year(1981)->countDays();
1 Like

I call the file from a template home.php

And I put it at the root of the website in a folder called forms

So in fact I do this to get it :


I think the path is good, cause I find on calendar.php line 213 like debug said this :

class Calendar {

I will try what you say !

Okay it seems to work !

I was trying different solutions and I put an other plugin in the directory at the same time. This last one has a calendar.php file in it too.

I guess the conflict came from there.

Sorry, thanks for your time and for the tips !