Word Herder (word_herder) wrote in component_help,
Word Herder
word_herder
component_help

Countdown Component

Just one other query:

Okay. So the Countdown Component is now on my journal. However, there is no actual date or time appearing. The code looks like it's supposed to show such items. Any idea of what I'm missing here?



var int e1time_difference  = -6;

var int e1daylight_savings = 0;

var int e1custom_day = 19;

var int e1custom_month = 3;

var int e1custom_year = 2005;

var int e1enable = 1;

var string e1misc_text = "Days Left Until Rome";

var string e1text = "";

var string e1title = "Countdown";



var int e1year   = $p.time.year;

var int e1day    = $p.time.day;

var int e1hour   = $p.time.hour + $e1time_difference;

var int e1min    = $p.time.min;

var int e1month  = $p.time.month;



if($e1daylight_savings){

  $e1hour = $e1hour + 1;

}

# figure out days in month

var int e1mondays = 31;

if($e1month == 4 or $e1month == 6  or $e1month == 9 or $e1month == 11) {

  $e1mondays = 30;

} elseif($e1month == 2) {

  if($e1year % 4 == 0){

    $e1mondays = 29;

  } else {

    $e1mondays = 28;

  }

}



var int e1febDays = $e1year % 4 == 0 ? 29 : 28; # number of days in february

var int e1isLeap  = $e1year % 4 == 0 ?  1 :  0; # is this a leap yr?

var int[] monthDays = [0, 31, $e1febDays, 31, 30, 31, 30, 31, 31, 30, 31, 30,

31]; # array of days per month



if($e1hour > 24) {                

    $e1hour = $e1hour - 6;        

    $e1day = $e1day + 1;          

  if($e1day > $e1mondays) {        

    $e1day = $e1day - $e1mondays;  

    $e1month = $e1month + 1;      

    if($e1month > 12) {            

      $e1month = 1;                

      $e1year = $e1year + 1;      

    }

  }

} elseif($e1hour < 0) {            

  $e1hour = 24 + $e1hour;          

  $e1day = $e1day - 1;            

  if($e1day < 1) {

    $e1month = $e1month - 1;

    if($e1month < 1) {

      $e1month = 12;

      $e1year = $e1year - 1;

    }

    $e1mondays = 31;

if($e1month == 4 or $e1month == 6  or $e1month == 9 or $e1month == 11) {

      $e1mondays = 30;

    } elseif($e1month == 2) {

      $e1mondays = ($e1year % 4) == 0 ? 29 : 28;

    }

    $e1day = $e1mondays;

}

}



var int e1diff_year = $e1custom_year - $e1year;

var int e1diff_day  = $e1custom_day  - $e1day;

var int e1days = ((365 + $e1isLeap) * $e1diff_year);

foreach var int i ($e1month + 1 .. $e1custom_month){



$e1days = $e1days + $monthDays[$i];

}

$e1days = $e1days + $e1diff_day;

if($e1enable == 1){

"""<b><font size = 2>$e1misc_text</b></font><p>""";

"""<img src="http://img.photobucket.com/albums/v286/narniabound/Pietasmallsize.jpg"><br><br><b>$e1days Day/s</b>""";

} else {

"""<b>$e1text<b>""";



</lj-ct>
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 4 comments