Tôi đã nhúng lịch Google hiển thị nhiều lịch trong trang web của mình, nhưng tôi muốn hiển thị lịch theo màu ngoài các tùy chọn mặc định.Bật lịch Google bằng các màu lịch tùy chỉnh
URL yêu cầu chứa tham số màu cho mỗi lịch, nhưng dường như không chấp nhận màu mặc định. (Các màu được hiển thị cũng không giống như các màu này)
Nhìn vào nguồn; màu sắc cho mỗi sự kiện được xác định bởi CSS nội tuyến và dường như không có thuộc tính lớp hoặc ID có thể được sử dụng để tạo kiểu cho chúng thông qua tệp CSS.
Tôi đã thử sử dụng PHP để lấy html của lịch và sau đó sử dụng chuỗi thay thế để thay đổi màu sắc (dựa trên this answer) hoạt động, ngoại trừ nó không thay đổi màu sắc Tệp PHP tôi đang sử dụng :
<?php
$content = file_get_contents('https://www.google.com/calendar/embed?showTitle=0&showPrint=0&showTabs=0&showTz=0&height=750&wkst=2&bgcolor=%23FFFFFF&src=1.keswickscouts.org_5d750s21fh55t45nsh4i49co5g%40group.calendar.google.com&color=%23691426&src=1.keswickscouts.org_k8ai784s6meu1eh71fk21etseg%40group.calendar.google.com&color=%23182C57&src=1.keswickscouts.org_4omjhqh48ud1lkigino18dmid0%40group.calendar.google.com&color=%232F6309&src=06illa48gj7en6896jv32cm93c%40group.calendar.google.com&color=%23125A12&src=1.keswickscouts.org_m6mb8idejtptmfkve9gm6latd8%40group.calendar.google.com&color=%236B3304&src=1.keswickscouts.org_5uaafulf65hrc4b64j3bfa6660%40group.calendar.google.com&color=%235229A3&src=1.keswickscouts.org_qudhcb0ii68u6b5mgs2ase200o%40group.calendar.google.com&color=%23B1365F&ctz=Europe%2FLondon');
$content = str_replace('</title>','</title><base href="https://www.google.com/calendar/" />',$content);
$content = str_replace('B5515D','CC9966', $content); //ASU
$content = str_replace('536CA6','099FF', $content); //Beavers
$content = str_replace('7EC225','33CC00', $content); //Cubs
$content = str_replace('125A12','006990', $content); //Eden
$content = str_replace('194D14','999966', $content); //Explorers
$content = str_replace('8C66D9','4D2177', $content); //Group
$content = str_replace('E67399','006666', $content); //Scouts
echo $content;
?>
Bất kỳ sugestions? Đơn giản hơn sẽ tốt hơn
Mã PHP được sử dụng để tạo lịch tại đây http://keswickscouts.org/test-page –