All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
  Offline
PostPosted: August 3rd, 2016, 8:35 pm 
King

Joined: February 24th, 2016, 8:29 pm
Posts: 555
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;
}
?>


Top
 Profile  
Reply with quote  
  Offline
PostPosted: August 5th, 2016, 8:23 pm 
King

Joined: February 24th, 2016, 8:29 pm
Posts: 555
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.


Top
 Profile  
Reply with quote  
  Offline
PostPosted: August 5th, 2016, 8:26 pm 
King

Joined: February 24th, 2016, 8:29 pm
Posts: 555
I meant we need to add a bottom-padding increase because it cuts off. Forgot to specify why


Top
 Profile  
Reply with quote  
  Offline
PostPosted: August 6th, 2016, 12:57 am 
User avatar
King

Joined: May 30th, 2015, 10:17 am
Posts: 3787
Location: Stirling - Scotland
Great addition. Nice to have it at the top of the page. Should look great when it's polished.

_________________
Talja-Sameria Tourmaline II - Tip of the Spear
Queen of Dawnstar, Deputy Minister for Hermertian Culture.
Adjudicator for Valyrian Affairs, Forums Administrator

Gold Roads. Fractal Mining. Lore Compliance Ducks.


Top
 Profile  
Reply with quote  
  Offline
PostPosted: August 6th, 2016, 4:15 am 
User avatar
Duke

Joined: June 1st, 2015, 12:47 am
Posts: 700
This is great! I can feel the convenience washing over me like the smell of fresh baked bread.

_________________
Ulrik Gunnarson
Duke of the Gathered Races of Hermertia Homeland (GRHH)
The Chairman of the GRHH Co.


Top
 Profile  
Reply with quote  
  Offline
PostPosted: August 6th, 2016, 7:38 pm 
User avatar
King

Joined: May 31st, 2015, 3:32 am
Posts: 843
I really like this addition as well! I was watching it take shape lol

_________________
Scrios V
King of Perth, Brother of Valyria


Top
 Profile  
Reply with quote  
  Offline
PostPosted: August 12th, 2016, 3:31 pm 
User avatar

Joined: April 28th, 2016, 6:15 pm
Posts: 2001
Location: California
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.

_________________
Ealdorman Cerdic Beoden Accynnafon of Östlond
Runner Up of the Glas Claddach Boat Building Competition
Minister of Justice


Top
 Profile  
Reply with quote  
  Offline
PostPosted: August 18th, 2016, 7:35 pm 
King

Joined: February 24th, 2016, 8:29 pm
Posts: 555
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.


Top
 Profile  
Reply with quote  
  Offline
PostPosted: August 18th, 2016, 7:37 pm 
User avatar

Joined: April 28th, 2016, 6:15 pm
Posts: 2001
Location: California
I think it really just needs to be moved up by what, 2 days? That's how far its been off each time.

_________________
Ealdorman Cerdic Beoden Accynnafon of Östlond
Runner Up of the Glas Claddach Boat Building Competition
Minister of Justice


Top
 Profile  
Reply with quote  
  Offline
PostPosted: August 18th, 2016, 7:38 pm 
King

Joined: February 24th, 2016, 8:29 pm
Posts: 555
Excellent, thanks for the tip. Let me experiment with a quick adjustement


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Imperium - Modified by Rey phpbbmodrey