Bạn ghé thăm diễn đàn lần đầu? hãy đăng ký ngay bây giờ để tham gia.
  • Đăng nhập:

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ý.


  • Partner Area
    • ITVNN HOSTING - Thiết kế website, Cung cấp Domain, Hosting, VPS Việt Nam Anh Hùng - Thông tin truyền thông
kết quả từ 1 tới 1 trên 1
Tăng kích thước phông chữ Giảm kích thước phông chữ
  1. #1
    admin's Avatar

    Trạng thái
    Offline
    Họ tên
    Mai Thanh Trung
    Tham gia ngày
    Aug 2006
    Thành viên thứ
    1
    Đến từ
    Pleiku, Gia Lai
    Tuổi
    39
    Giới tính
    Bài gởi
    4,984
    Level: 57 [?]
    Experience: 32,268,405
    Next Level: 35,467,816
    Cảm ơn 53
    Cảm ơn 2,450 lần / 1,409 Bài viết

    Default 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...
    HTML Code: 
    <script src="scripts/eventcountdown.js" type="text/javascript"></script>
    ...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(000date(date("m")), date(date("d")),  date(date("y")));
    $and=" and dateline_from > '".$today_date."'";

    $getevents=$db->query_read("SELECT eventid, title, dateline_from from " TABLE_PREFIX "event WHERE calendarid='".$event_calendarid."' $and order by dateline_from ASC LIMIT 2");
    $count=1;
    if(!
    $db->num_rows($getevents))
    {
    echo 
    $no_events_message;

    else
    {
    echo 
    "<script type='text/javascript'>\n";
    WHILE (
    $events=$db->fetch_array($getevents))
    {
    $event_title=$events['title'];
    $event_date vbdate('U',$events['dateline_from'], false,true,false,true)-vbdate('U');
    if(
    $count==1)
    {
    echo 
    "var CountDownTimer=new CountDown('CountDownToChange',1,'".$event_title."<br />','".$event_date."','ywdhms',1)\n";
    }
    else
    {
    echo 
    "CountDownTimer.AddNewEvent('".$event_title."<br />','".$event_date."','ywdhms',".$count.")\n";
    }
    $count++;
    }
    }
    echo 
    "CountDownTimer.DisplayTime(FormatResults)\n";
    echo 
    "</script>\n";
    $db->free_result($getevents);
    unset(
    $events);
    $output=ob_get_contents();
    ob_end_clean(); 
    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.

    Screenshots:
    File Kèm Theo File Kèm Theo
    .♥.Thà không yêu cho cuộc đời trong trắng.♥.
    .♥.Lỡ yêu rồi phải cố gắng thành công.♥.


    Thiết kế website, Cung cấp Domain, Hosting, VPS


 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Javascript Countdown on Forumhome
    By admin in forum v4.x Modifications
    Trả lời: 2
    Bài mới gởi: 11-10-2011, 08:58 AM
  2. Member Countdown (vB4)
    By PhucSD in forum v4.0.x Modifications
    Trả lời: 0
    Bài mới gởi: 04-07-2011, 04:40 PM
  3. Member Countdown (vB4)
    By PhucSD in forum v4.x Modifications
    Trả lời: 0
    Bài mới gởi: 04-07-2011, 04:40 PM
  4. Living NFS New Year Countdown 2 v1.1
    By itvnn59 in forum System Tools
    Trả lời: 1
    Bài mới gởi: 12-12-2010, 10:03 AM
  5. Zero-Day Exploit: Countdown to Darkness
    By MrZen in forum E-books
    Trả lời: 0
    Bài mới gởi: 28-09-2009, 06:09 PM

Tags for this Thread

Bookmarks

Quuyền Hạn Của Bạn

  • Bạn không thể tạo chủ đề mới
  • Bạn không thể trả lời bài viết
  • Bạn không thể gửi file đính kèm
  • Bạn không thể chỉnh sửa bài viết
  •