The Mercurian Empire
http://hermertia.com/

Where should we put the date?
http://hermertia.com/viewtopic.php?f=14&t=918
Page 1 of 1

Author:  The Regent [ August 3rd, 2016, 8:35 pm ]
Post subject:  Where should we put the date?

Check it friends! Probably has a few glitches (I want to see as the days pass), but attached is an automated calendar.

http://codydodd.ca/hermertia/cal.php

To anyone with access to the server files: I can help you paste the code in to any place on the site. It's actually super simple. Or, if someone gives me temporary access I can load it in.

Before that, it's worth asking the community. Where should this simple text go? We can stylize it depending on where we are putting it. It could be super optimized. I did this from start to scratch in under an hour. It was a fun little challenge re: a new hobby i've been learning.

Code:
<?php
$day = date('d');
$mercannum = $day / 6;
$base_year = -2;
if ($mercannum >= 0 && $mercannum < 1) {
   $extra_year = $base_year;
} else if ($mercannum >= 1 && $mercannum < 2) {
   $extra_year = $base_year +1;
} else if ($mercannum >= 2 && $mercannum < 3) {
   $extra_year = $base_year +2;
} else  if ($mercannum >= 3 && $mercannum < 4) {
   $extra_year = $base_year +3;    
} else if ($mercannum >= 4 && $mercannum < 5) {
   $extra_year = $base_year +4; }   
?><BR><?php
$date1 = '2009-07-31';
//$date2 = '2016-08-03';
$date2 = date('Y-m-d');
$ts1 = strtotime($date1);
$ts2 = strtotime($date2);
$year1 = date('Y', $ts1);
$year2 = date('Y', $ts2);
$month1 = date('m', $ts1);
$month2 = date('m', $ts2);
$month_diff = (($year2 - $year1) * 12) + ($month2 - $month1);
$canonyears_diff = $month_diff * 6;
$current_year = $canonyears_diff + $extra_year;
echo "Years of the Emperor: " . $current_year . " AI ";
$date3 = '2016-08-31';
$ts1 = strtotime($date3);
$ts2 = strtotime($date2);
$year1 = date('Y', $ts1);
$year2 = date('Y', $ts2);
$month1 = date('m', $ts1);
$month2 = date('m', $ts2);
$cycle_check_month_diff = (($year2 - $year1) * 12) + ($month2 - $month1);
//echo $month_diff;
?><BR><?php
$cycle_base = '2015-06-01';
$ts1 = strtotime($cycle_base);
$ts2 = strtotime($date2);
$year1 = date('Y', $ts1);
$year2 = date('Y', $ts2);
$month1 = date('m', $ts1);
$month2 = date('m', $ts2);
$cycle_month_diff = (($year2 - $year1) * 12) + ($month2 - $month1);
$cycle_merc = round($cycle_month_diff / 12);
$cycle_year = $cycle_month_diff % 12;
$cycle_merc_padded = sprintf("%02d", $cycle_merc);
$cycle_year_padded = sprintf("%02d", $cycle_year);
?><BR><?php
if ($cycle_check_month_diff > 1) {
   echo "Cycle of the Tides: " . $cycle_merc_padded . "-" . $cycle_year_padded;
} else {
   echo "Cycle of the Phoenix: " . $cycle_merc_padded . "-" . $cycle_year_padded;
}
?>

Author:  The Regent [ August 5th, 2016, 8:23 pm ]
Post subject:  Re: Where should we put the date?

Super sick work Atryl! All you need to do now is give the div container that the header box is in a bottom padding. My Internet totally crapped out today (using my phone instead) but I will try to get on and trouble shoot someone through it. Or, I will take a look at the source code once my net is back and send the likely CSS edits to make.

Super sick! There might be a few glitches to the algorithm, easily fixable, so let's monitor it for the next while and report back here any issues?

Solid work Atryl. You are a hero of our times.

Author:  The Regent [ August 5th, 2016, 8:26 pm ]
Post subject:  Re: Where should we put the date?

I meant we need to add a bottom-padding increase because it cuts off. Forgot to specify why

Author:  Petra Ravnikaar [ August 6th, 2016, 12:57 am ]
Post subject:  Re: Where should we put the date?

Great addition. Nice to have it at the top of the page. Should look great when it's polished.

Author:  The Chairman [ August 6th, 2016, 4:15 am ]
Post subject:  Re: Where should we put the date?

This is great! I can feel the convenience washing over me like the smell of fresh baked bread.

Author:  Scrios V [ August 6th, 2016, 7:38 pm ]
Post subject:  Re: Where should we put the date?

I really like this addition as well! I was watching it take shape lol

Author:  Cerdic Accynnafon [ August 12th, 2016, 3:31 pm ]
Post subject:  Re: Where should we put the date?

It's not right.

It said it was 509 2 days before it actually was, and was a day late to saying it was 510.

Author:  The Regent [ August 18th, 2016, 7:35 pm ]
Post subject:  Re: Where should we put the date?

Excellent, thanks for raising that. I knew the formula would require tweaking, as some things couldn't be tested until time moved through. As soon as I am on (what ever voice program we use?) with you Mark, I'll tweak it as per your help.

Author:  Cerdic Accynnafon [ August 18th, 2016, 7:37 pm ]
Post subject:  Re: Where should we put the date?

I think it really just needs to be moved up by what, 2 days? That's how far its been off each time.

Author:  The Regent [ August 18th, 2016, 7:38 pm ]
Post subject:  Re: Where should we put the date?

Excellent, thanks for the tip. Let me experiment with a quick adjustement

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/