I am trying to get my Tides section to work. But it is not updating like it should. Not sure if I am missing something. The tideprediction.html is in the root directory.
This is the sections in altajaxdashboardconfig6 script.
$useLIGT = false; // set to true to show lightning counts when there is no snow on the ground.
// (if true, Lightning will over-ride TIDE display if more then $minLcnt (set below) is reached in 5 mins)
$useSNOW = false; // Normally always TRUE unless you want TIDE to Display. SNOW & TIDE CANNOT BE BOTH TRUE!!!
// Snow will over-ride the lightning section if you have snow on the ground.
$useTIDE = true; // Set to True to display TIDE information.
// Lightning will over-ride Tide. SNOW & TIDE CANNOT BE BOTH TRUE!!!
$S3C2 = '2'; // Over-ride status: If Lightning is TRUE, this allows Lightning to over-ride either Tide or Snow
// Set as follows:
// 0 = None Shows (All three previous setting are FALSE)
// 1 = Just Snow No Lightning over-ride (Snow must be set to TRUE)
// 2 = Just Tide No Lightning over-ride (Tide must be set to TRUE)
// 3 = Just Lightning (Lightning must be set to TRUE)
// 4 = Snow with Lightning Over-ride (SNOW and LIGHTNING must be set to TRUE)
// 5 = Tide with Lightning Over-ride (TIDE and LIGHTNING must be set to TRUE)
$tidefile = "tideprediction.html";// Set the server path to your tideprediction.html file
$yearDate = "yes";// If your tide dates include years (Monday 2008-09-10) change this to "yes"
// You can convert "Rising & Falling" format to standard "High & Low" //
// by changing the following to "yes". //
$convertRF = "no";
// timezone offset hours server time vs. tides time
$time_offset_next_tide = 0; // You may need different values here depending if your server is in a different timezone
if (isset($_REQUEST['sce']) && ( strtolower($_REQUEST['sce']) == 'view' or
strtolower($_REQUEST['sce']) == 'show')) {
//--self downloader --
$filenameReal = __FILE__;
$download_size = filesize($filenameReal);
header('Pragma: public');
header('Cache-Control: private');
header('Cache-Control: no-cache, must-revalidate');
header("Content-type: text/plain");
header("Accept-Ranges: bytes");
header("Content-Length: $download_size");
header('Connection: close');
readfile($filenameReal);
exit;
This is the section in the ajax-dashboard6.php below
// The following function are for the TIDE module
function next_tide_info($tideinfo, $day) {
global $time_offset_next_tide;
//$tideinfo = ' High Tide: 2049 6.0';
//make an array out of the string, split on the space char after removing multiple spaces
$t_arr = explode(" ", preg_replace('/\s\s+/', ' ', trim($tideinfo)));
//print_r ($t_arr);
//Array ( [0] => High [1] => Tide: [2] => 2049 [3] => 6.0 )
// now time in seconds
$time_now = (time() - ($time_offset_next_tide * (60 * 60)));
// get tide time in seconds.
$t_hr = substr($t_arr[2], 0, 2);
$t_min = substr($t_arr[2], -2);
$t_time = strtotime(date("Y-m-d", $time_now + (86400 * $day)) . " $t_hr:$t_min:" . date('s'));
// next tide in minutes
$t_diff = round(($t_time - $time_now) / 60);
$next_t1 = array(
"$t_diff" => strtolower($t_arr[0]),
);
return $next_t1;
}
// end function mins_to_next_tide
function round_tide_time($mins_to_next_tide) {
if ($mins_to_next_tide <= 0)
return 0;
if ($mins_to_next_tide >= 360)
return 360;
//echo "mins_to_next_tide: $mins_to_next_tide<br>";
$mins_to_next_tide = (round($mins_to_next_tide / 15) * 15);
return $mins_to_next_tide;
}
// end function round_tide_time
global $nexttidequarter;
function select_tide_image($mins_to_next_tide, $high_or_low) {
global $nexttidequarter;
if ($high_or_low == 'high')
$nexttidequarter = "High$mins_to_next_tide";
if ($high_or_low == 'low')
$nexttidequarter = "Low$mins_to_next_tide";
if ($mins_to_next_tide <= 0)
return $high_or_low . '_0.jpg';
if ($mins_to_next_tide >= 360)
return $high_or_low . '_360.jpg';
return $high_or_low . '_' . $mins_to_next_tide . '.jpg';
}
// end function select_tide_image
function time_till_tide($time) {
// takes a time diff like 6740 secs and formats to '1 hour, 52 minutes'
$hrs = (int) intval($time / 3600);
$time = (int) intval($time - (3600 * $hrs));
$mns = (int) intval($time / 60);
$time = (int) intval($time - (60 * $mns));
$secs = (int) intval($time / 1);
$hrs == 1 and $string .= "$hrs hour, ";
$hrs > 1 and $string .= "$hrs hours, ";
$string .= sprintf("%01d minutes", $mns);
return $string;
}
function tide_data($numb) {
global $tidefile, $yearDate, $convertRF;
$tideD = implode('', file($tidefile));
$time = time();
// Get tide records by date, cut to length and split
// If year is included in date
if ($yearDate == "yes") {
$tidedate = strstr($tideD, date("l Y-m-d", $time + (86400 * $numb)));
$tideEnd = strpos($tideD, date("l Y-m-d", $time + (86400 * ($numb + 1))));
} else {
$tidedate = strstr($tideD, date("l m-d", $time + (86400 * $numb)));
$tideEnd = strpos($tideD, date("l m-d", $time + (86400 * ($numb + 1))));
//$tidedate = strstr($tideD, date("D m-d", $time + (86400 * $numb)));
//$tideEnd = strpos($tideD, date("D m-d", $time + (86400 * ($numb + 1))));
}
// The last tide will not show because it is not followed by a date. So we will
// set the end possition to a fixed leangth
if (!$tideEnd == false) {
$tide = substr($tidedate, 0, $tideEnd);
} else {
$tide = substr($tidedate, 0, 280);
}
// Check if tides are in rising/falling format
if (strstr($tide, "Rising")) {
$risingFormat = "yes";
//$tide = substr($tidedate, 0, $tideEnd);
}
$tide = explode("\n", $tide);
// Check if sunrise info is included
if (strstr($tide[1], "Sunrise")) {
$tide = $tide[0] . "|" . $tide[3] . "|" . $tide[4] . "|" . $tide[5] . "|" . $tide[6] . "|" . $tide[7] . "|" . $tide[8] . "|" . $tide[9] . "|" . $tide[10];
$tide = explode("|", $tide);
} else {
$tide = $tide[0] . "|" . $tide[1] . "|" . $tide[2] . "|" . $tide[3] . "|" . $tide[4] . "|" . $tide[5] . "|" . $tide[6] . "|" . $tide[7] . "|" . $tide[8];
$tide = explode("|", $tide);
}
return $tide;
}
// eof minutes to next tide
// END OF ALL TIDE FUNCTIONS