Chào mừng bạn đến với ITVNN FORUM - Diễn đàn công nghệ thông tin.
Nếu đây là lần đầu tiên bạn tham gia diễn đàn, xin mời bạn xem phần Hỏi/Ðáp để biết cách dùng diễn đàn. Để có thể tham gia thảo luận bạn phải đăng ký làm thành viên, click vào đây để đăng ký.
Level: 57 [?]
Experience: 32,288,319
Next Level: 35,467,816
Cảm ơn 53
Cảm ơn 2,450 lần / 1,409 Bài viết
Countdown to Calendar Event
This widget picks up the next 2 events from a calendar of your choice.
It displays a countdown to the first event then once the first event has arrived it begins a countdown to the second event. The only reason for picking up two events is that someone may visit the page close to the end of the first event then see the no event message. By picking up two events such a visitor will see the countdown to the second event start.
To install...
From the ZIP file, extract eventcountdown.js and copy it to your site.
Navigate to AdminCP -> Style & Templates -> Style Manager -> Edit Template
Double click the headinclude template to edit it and add the following just above the first <script tag you find...
...the above assumes you have copied eventcountdown.js file in to a folder called scripts. Adjust the src path to wherever you have placed the .js file.
Navigate to AdminCP -> CMS -> Widgets.
Create a PHP Type Widget and paste the below code.
PHP Code:
global $db,$vbulletin; $event_calendarid="1"; $no_events_message="<div style='width: 100%; text-align: center; font-weight: bold'>There are no events.</div>"; $today_date = mktime(0, 0, 0, date(date("m")), date(date("d")), date(date("y"))); $and=" and dateline_from > '".$today_date."'";
You can set the value for $event_calendarid to the calendar that you want countdown events to come from. Change $no_events_message to the HTML you want to have appear when there are no events left in the selected calendar.
This is the first widget I've written so if you spot any errors or improvements that can be made then please let me know.
If you have an all day event in the calendar the countdown is to the begining of that day. Add a ranged event to the calendar for an exact time. Also, allow for any changes that may occur if a change to or from DST occurs.
Bookmarks