Calendario Caldata from Database

2 replies · opened Feb 18, 2021

Mmarinos13Feb 18, 2021

Hello,

I am trying to create a calendar that reads the events from a database instead of reading them from the events-data.js file but I am not sure how to do that.

var cal = $( '#calendar' ).calendario( {
      onDayClick : function( $el, $contentEl, dateProperties ) {

        for( var key in dateProperties ) {
          console.log( key + ' = ' + dateProperties[ key ] );
        }

      },
      caldata : canvasEvents
    } ),
    $month = $( '#calendar-month' ).html( cal.getMonthName() ),
    $year = $( '#calendar-year' ).html( cal.getYear() );

I have tried adding <?php?> code instead of the canvasEvents but its not working.

SSemicolon WebSTAFFFeb 18, 2021

Hello,

This is Definitely Possible and can be achieved by outputting the Event Data in JSON Format using a PHP File or you can directly add the Events Data in the JS Initialization Codes at bottom of the Page using this setting: caldata : canvasEvents. The canvasEvents Variable stores the JSON Data for the calendar similar to the js/events-data.js File.

Let us know if we can help you with anything else or if you find any further issues.

Mmarinos13Feb 19, 2021

Thank you! Its working properly now.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard