1
What I wanted to do, was to put inside a JS calendar the data I pull from B.D by PHP: The events in this format:
events: [{
title: 'All Day Event',
start: new Date(y, m, 1),
backgroundColor: "#f56954", //red
borderColor: "#f56954" //red
}, ],
Being that I did this function in PHP just to take all the BD events and put 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 don’t know how to put PHP inside JS.