Closed gigilsu closed 8 years ago
Can you pls. show how you fill the $events variable? Looks like you might have an EOF<<< < to much;)
$events = Event::find()->all();
$tasks = [];
foreach ($events as $event) {
$calEvent = new \yii2fullcalendar\models\Event();
$calEvent->id = $event->id;
$calEvent->title = $event->name;
$calEvent->start = $event->start_date;
$calEvent->end = $event->end_date;
$tasks[] = $calEvent;
}
return $this->render('index', [
'events' => $tasks,
]);
Oops, I replied but I was on the wrong username.
Although that syntax error shows on firebug, I checked the html output at https://validator.w3.org and the only thing it showed as error was the following: Attribute theme not allowed on element div at this point. .... < div id="w0" class="fullcalendar" theme data-plugin-name="fullCalendar" >
The calendar does show up and I am still able to add a click event to it, so I'm not sure why that error shows up on firebug. I'm also not sure about the theme word inserted in that div tag. I did not see it when I viewed source on the example calendar at http://yii2fullcalendar.beeye.org
hmm, this is actually mystic... did you try to render the calender without events? I'll check the code where it greats the div - 20 min
@gigilsu thanks for keeping me reminded. I had the theme attribute defined in options, which is actually wrong - looked like - so moved the theme = 1/0 to the main config attributes and now the div renderer should work fine!
Sorry and thanks for your convinience
To answer your question about rendering the calendar without events: yes, I get the firebug error even when I render the calendar without events, however, thank you for fixing the theme issue. On a side note, your latest update is missing a semicolon at the end of description in your Event model at line 31.
I added phillippfrenzel/yii2fullcalendar via composer, and then added the following to my view page: <?= \yii2fullcalendar\yii2fullcalendar::widget(array( 'events'=> $events, )); ?>
I am trying to add a click event to add new events within the calendar, however I am getting an error hen I add the above line of code and I can't get the click event to work. The calendar loads with my events, but shows the following error on firebug : SyntaxError: expected expression, got '<' <!DOCTYPE html>