philippfrenzel / yii2fullcalendar

JQuery Fullcalendar Yii2 Extension
GNU General Public License v2.0
133 stars 97 forks source link

Syntax Error on Firebug #32

Closed gigilsu closed 8 years ago

gigilsu commented 8 years ago

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>

philippfrenzel commented 8 years ago

Can you pls. show how you fill the $events variable? Looks like you might have an EOF<<< < to much;)

l8holdings commented 8 years ago
    $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,
    ]);
gigilsu commented 8 years ago

Oops, I replied but I was on the wrong username.

gigilsu commented 8 years ago

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

philippfrenzel commented 8 years ago

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

philippfrenzel commented 8 years ago

@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

gigilsu commented 8 years ago

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.