I want to show only my TODAYS events in my html output. But with this code it doesnt work for me. If I cancel the line "if ($date = date("Ymd")){" the code shows a specific count of events... But how can I create the output for all event on one day only?
if ($date = date("Y-m-d")){
foreach ($xml->entry as $entry){
$count++;
// Viele weitere Informationen kˆnnen aus dem XML geholt werden wie z.B. $entry->description;
// f¸r die Beschreibung und viele Weitere. Einfach mal das XML-File durchstˆbern.
// Schema f¸r den Google Cal XML Ausgabe laden.
$ns_gd = $entry->children('http://schemas.google.com/g/2005');
$gCalDate = date($dateformat, strtotime($ns_gd->when->attributes()->startTime)+date("Z",strtotime($ns_gd->when->attributes()->startTime)));
$gCalDateStart = date($dateformat, strtotime($ns_gd->when->attributes()->startTime)+date("Z",strtotime($ns_gd->when->attributes()->startTime)));
$gCalDateEnd = date($dateformat, strtotime($ns_gd->when->attributes()->endTime)+date("Z",strtotime($ns_gd->when->attributes()->endTime)));
$gCalStartTime = gmdate($timeformat, strtotime($ns_gd->when->attributes()->startTime)+date("Z",strtotime($ns_gd->when->attributes()->startTime)));
$gCalEndTime = gmdate($timeformat,strtotime($ns_gd->when->attributes()->endTime)+date("Z",strtotime($ns_gd->when->attributes()->endTime)));
$ort=($ns_gd->where->attributes()->valueString);
echo "Datum: ".$gCalDateStart //Datum
."<br/>". "Aufgabe: ".utf8_decode($entry->title) // Titel
."<br/>". "Ort: ".$ort // Raum
."<br/>". "Beschreibung: ".utf8_decode($entry->content); // Beschreibung
if($count >=5){ echo "</div> "; break; }else{ echo "<hr>"; }
}}
You're using the wrong operator in
if ($date = date("Y-m-d")){
This sets the date. You want to use ==, which compares the values:
if ($date == date("Y-m-d")){
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.