What I wanted to do, was to put inside a JS calendar the data I pull from B.D through PHP: Events in this format:
events: [{
title: 'All Day Event',
start: new Date(y, m, 1),
backgroundColor: "#f56954", //red
borderColor: "#f56954" //red
}, ],
I have done this function in PHP just to get all the events of the DB and put it inside a String:
$eventosJS = "";
foreach($eventos as $key => $value) {
$a = substr($value['data'], -19, 4);
$m = substr($value['data'], -5, 2);
$d = substr($value['data'], -2, 2);
$hrI = substr($value['hora_inicio'], -8, 2);
$minI = substr($value['hora_inicio'], -5,
2);
$hrF = substr($value['hora_fim'], -8, 2);
$minF = substr($value['hora_fim'], -5, 2);
$eventosJS = $eventosJS.
",".
"{ title:'Teste ', start: new Date(".$a.
",".$m.
",".$d.
",".$hrI.
",".$minI.
"), end: new Date(".$a.
",".$m.
",".$d.
",".$hrF.
",".$minF.
"), backgroundColor:
'#f39c12', borderColor: '#f39c12'
}
"; }
But I do not know how to put PHP inside JS.