Hey skafreak, so glad you are having results.
I had done all what you posted a few days ago but still not having results with mine.
but give unexpected results because I think the php is different syntax.
It tells me that the page needs refreshing, this is an error message from the script I am using.
Kinda sucks and is prob down to different syntax.
At a loose end now and am prob gonna ditch the phpbb custom pages idea and just design my own using dreamweaver.
I am gutted, but I will post up what my script does incase someone can spot a problem.
Code: Select all
<?php
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
// Tide Processor //
$SCVersion= "V2.02" ;//
// by Al Rooker //
// www.NewtonAndNoss.com/weather/tech/ //
// //
// Subscribe to my Weather Tech e-mail list for updates and new scripts etc!! //
// //
// This script is free for non commercial use only. If you use it on your site //
// please feel free to give me credit and a link back to my site! Thanks. //
// //
// What does this script do? Well it takes your tideprediction.html file and //
// turns the data into something you can actually use, and layout as you like! //
// //
// 1. Change the settings below, then upload this file anywhere on your site. //
// 2. Upload the moon icons to where ever you like, then set their URL below. //
// 3. On any php page on your site where you want to display tides add the //
// following and change to your actual server path!; //
// require_once("/home/user/www/tides_processor.php"); //
// 4. Where ever you want to display a tide record add the following; //
// <! tides(0); !> (replace ! with ?) The number "0" means today. So this //
// would display today's tides. "1" will display tomorrow's tides, and //
// "2" will display the next day and so on, up to about 20. It won't display //
// tide times from the past so "0" is always today. //
// 5. Where ever you want to display a sun & moon record add the following; //
// <! sunmoon(0); !> (replace ! with ?). The numbering is the same as above.//
// If you do not want to include the date add ,nodate like this; //
// <! sunmoon(2,nodate); !> //
// //
// //
// Set the server path to your tideprediction.html file //
$tidefile = "http://www.tbyc.org/weather/tideprediction.html"; //
// //
// Set the URL to the moon icons - no trailing slash //
$moonimg = "icons"; //
// //
// If your tide dates include years (Monday 2008-09-10) change this to "yes" //
$yearDate = "yes"; //
// //
// You can convert "Rising & Falling" format to standard "High & Low" //
// by changing the following to "yes". //
$convertRF = "no"; //
// // //
// If you do not want to show moon phase icons in tides put "yes" below //
$TmoonPhaseOff = "no"; //
// If you do not want to show moon phase icons in Sun & Moon times put "yes" //
$SmoonPhaseOff = "no"; //
// // //
// //
// TRANSLATE FROM ENGLISH TO OTHER LANGUAGE //
// If you want to translate from English to another language..... //
// Replace the following words //
$translate = array("High Tide", "Low Tide", "Rising", "Falling", "Sunrise", "Sunset", "Moonrise", "Moonset"); // //
// Replace month names //
$months = array(" ", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
// Replace day names //
$transDay = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
//==============================================================================//
//======================= Nothing Else To Change ===============================//
//================== No user servicable parts inside :) ========================//
//==============================================================================//
//
function tides($numb = 0, $echoOff = 0)
{
global $tidefile;
global $moonimg;
global $convertRF;
global $yearDate;
global $TmoonPhaseOff;
global $translate;
global $months;
global $transDay;
// Get tide file
error_reporting(0);
$tideD = implode('', file($tidefile));
if ($tideD == false)
{
// If there is no data we assume the tide file is currently being uploaded!
echo "<font color = \"red\">Tide data is being updated. Please refresh the page.</font>";
}
// Time & default words
$time = time();
$days = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
$tideWords = array("High Tide", "Low Tide", "Rising", "Falling");
//
// 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))));
}
// 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);
}
// Convert date format to short day and full month names (UK format)
if ($yearDate == "yes")
{
$tideraw1 = $tide[0];
$dateraw = str_replace(" ","-", $tideraw1);
$dateraw = explode("-", $dateraw);
// Fix missing months on month numbers preseded by 0 with years in date
if (strlen($dateraw[2]) == 2 && substr($dateraw[2],0,1) == 0)
{
$dateraw[1] = substr($dateraw[2],1,1);
}
$daterawM = $months[$dateraw[2]];
}else{
$tideraw1 = $tide[0];
$dateraw = str_replace(" ","-", $tideraw1);
$dateraw = explode("-", $dateraw);
// Fix missing months on month numbers preseded by 0
if (strlen($dateraw[1]) == 2 && substr($dateraw[1],0,1) == 0)
{
$dateraw[1] = substr($dateraw[1],1,1);
}
$daterawM = $months[$dateraw[1]];
}
// translate days
$Day =str_replace($days, $transDay, $dateraw[0]);
if ($yearDate == "yes")
{
$dformat = substr($Day,0,3)." ".$dateraw[3]." ".$daterawM;
}else{
$dformat = substr($Day,0,3)." ".$dateraw[2]." ".$daterawM;
}
// Get moon details and show icons
if ($TmoonPhaseOff !== "yes")
{
$mooninfo= "$dateraw[0] $dateraw[1]-$dateraw[2]";
$mooninfo = str_replace($mooninfo, "", $tide[0]);
if (strstr($mooninfo, "First Quarter Moon"))
{
$moonimage = "<img src=\"$moonimg/tide_moon1stQ.gif\" alt=\"$mooninfo\" width=\"12\" height=\"10\">";
}else if (strstr($mooninfo, "Last Quarter Moon"))
{
$moonimage = "<img src=\"$moonimg/tide_moonlastQ.gif\" alt=\"$mooninfo\" width=\"12\" height=\"10\">";
}else if (strstr($mooninfo, "Full Moon"))
{
$moonimage = "<img src=\"$moonimg/tide_moonfull.gif\" alt=\"$mooninfo\" width=\"12\" height=\"10\">";
}else if (strstr($mooninfo, "New Moon"))
{
$moonimage = "<img src=\"$moonimg/tide_moonnew.gif\" alt=\"$mooninfo\" width=\"12\" height=\"10\">";
}
}
//
// Check whether we are using Rising & Falling format
if ($risingFormat == "yes")
{
// Adjust Rising Falling Format for 3 tide days and 4 tide days
if (strstr($tide[10], $days))
{
$tides = $tide[0]."|".$tide[1]."|".$tide[2]."|".$tide[3]."|".$tide[4]."|".$tide[5]."|".$tide[6]."|".$tide[7];
}else{
$tides = $tide[0]."|".$tide[1]."|".$tide[2]."|".$tide[3]."|".$tide[4]."|".$tide[5]."|".$tide[6]."|".$tide[7]."|".$tide[8];
}
$tide = explode("|", $tides);
//
// Convert Rising Falling format to standard if set in options
if ($convertRF == "yes")
{
if (strstr($tide[1], "Rising") Xor (strstr($tide[1], "Falling")))
{
$tides = "<b>".$dformat." ".$moonimage."</b><br>".str_replace($tideWords, $translate, $tide[2])."<br>".str_replace($tideWords, $translate, $tide[4])."<br>".str_replace($tideWords, $translate, $tide[6])."<br>".str_replace($tideWords, $translate, $tide[8]);
}else{
// if it's not in row 1 it's in row 2
$tides = "<b>".$dformat." ".$moonimage."</b><br>".str_replace($tideWords, $translate, $tide[1])."<br>".str_replace($tideWords, $translate, $tide[3])."<br>".str_replace($tideWords, $translate, $tide[5])."<br>".str_replace($tideWords, $translate, $tide[7]);
}
}else{
$tides = "<b>".$dformat." ".$moonimage."</b><br>".str_replace($tideWords, $translate, $tide[1])."<br>".str_replace($tideWords, $translate, $tide[2])."<br>".str_replace($tideWords, $translate, $tide[3])."<br>".str_replace($tideWords, $translate, $tide[4])."<br>".str_replace($tideWords, $translate, $tide[5])."<br>".str_replace($tideWords, $translate, $tide[6])."<br>".str_replace($tideWords, $translate, $tide[7])."<br>".str_replace($tideWords, $translate, $tide[8])."<br>".str_replace($tideWords, $translate, $tide[9]);
}
}else{
// Working with regular High & Low format
// Adjust regular format for 2 tide days, 3 tide days and 4 tide days
if (strstr($tide[3], date("m-d", $time+(86400*($numb+1)))))
{
$tides = $tide[0]."|".$tide[1];
}else if (strstr($tide[4], date("m-d", $time+(86400*($numb+1)))))
{
$tides = $tide[0]."|".$tide[1]."|".$tide[2];
}else{
$tides = $tide[0]."|".$tide[1]."|".$tide[2]."|".$tide[3]."|".$tide[4];
}
$tide = explode("|", $tides);
$tides = "<b>".$dformat." ".$moonimage."</b><br>".str_replace($tideWords, $translate, $tide[1])."<br>".str_replace($tideWords, $translate, $tide[2])."<br>".str_replace($tideWords, $translate, $tide[3])."<br>".str_replace($tideWords, $translate, $tide[4]);
}
if (strlen($tides) < 50)
{
echo "";
}else{
if ($echoOff == "1")
{
return $tides;
}else{
echo $tides;
}
}
}
//
//
// Sun & Moon rise & set function
function sunmoon($numb = 0, $showDate = "yes", $echoOff = 0)
{
global $tidefile;
global $moonimg;
global $yearDate;
global $SmoonPhaseOff;
global $translate;
global $months;
global $transDay;
// Get tide file
error_reporting(0);
$tideD = implode('', file($tidefile));
if ($tideD == false)
{
// If there is no data we assume the tide file is currently being uploaded!
echo "<font color = \"red\">Data is being updated. Please refresh the page.</font>";
}
// Time & default words
$time = time();
$days = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
$tideWords = array("High Tide", "Low Tide", "Rising", "Falling", "Sunrise", "Sunset", "Moonrise", "Moonset");
//
// 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))));
}
// 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);
}
$tide = explode("\n", $tide);
// Convert date format to short day and full month names (UK format)
if ($yearDate == "yes")
{
$tideraw1 = $tide[0];
$dateraw = str_replace(" ","-", $tideraw1);
$dateraw = explode("-", $dateraw);
// Fix missing months on month numbers preseded by 0 with years in date
if (strlen($dateraw[2]) == 2 && substr($dateraw[2],0,1) == 0)
{
$dateraw[1] = substr($dateraw[2],1,1);
}
$daterawM = $months[$dateraw[2]];
}else{
$tideraw1 = $tide[0];
$dateraw = str_replace(" ","-", $tideraw1);
$dateraw = explode("-", $dateraw);
// Fix missing months on month numbers preseded by 0
if (strlen($dateraw[1]) == 2 && substr($dateraw[1],0,1) == 0)
{
$dateraw[1] = substr($dateraw[1],1,1);
}
$daterawM = $months[$dateraw[1]];
}
// translate days
$Day =str_replace($days, $transDay, $dateraw[0]);
if ($yearDate == "yes")
{
$dformat = substr($Day,0,3)." ".$dateraw[3]." ".$daterawM;
}else{
$dformat = substr($Day,0,3)." ".$dateraw[2]." ".$daterawM;
}
// Get moon details and show icons
if ($SmoonPhaseOff !== "yes")
{
$mooninfo= "$dateraw[0] $dateraw[1]-$dateraw[2]";
$mooninfo = str_replace($mooninfo, "", $tide[0]);
if (strstr($mooninfo, "First Quarter Moon"))
{
$moonimage = "<img src=\"$moonimg/tide_moon1stQ.gif\" alt=\"$mooninfo\" width=\"12\" height=\"10\">";
}else if (strstr($mooninfo, "Last Quarter Moon"))
{
$moonimage = "<img src=\"$moonimg/tide_moonlastQ.gif\" alt=\"$mooninfo\" width=\"12\" height=\"10\">";
}else if (strstr($mooninfo, "Full Moon"))
{
$moonimage = "<img src=\"$moonimg/tide_moonfull.gif\" alt=\"$mooninfo\" width=\"12\" height=\"10\">";
}else if (strstr($mooninfo, "New Moon"))
{
$moonimage = "<img src=\"$moonimg/tide_moonnew.gif\" alt=\"$mooninfo\" width=\"12\" height=\"10\">";
}
}
// Final output
if ($showDate == "nodate")
{
$moonsun = str_replace($tideWords, $translate, $tide[1])."<br>".str_replace($tideWords, $translate, $tide[2]);
}else{
$moonsun = "<b>".$dformat." ".$moonimage."</b><br>".str_replace($tideWords, $translate, $tide[1])."<br>".str_replace($tideWords, $translate, $tide[2]);
}
if (strlen($moonsun) < 40)
{
echo "";
}else{
if ($echoOff == "1")
{
return $moonsun;
}else{
echo $moonsun;
}
}
}
//
//
function tidesv()
{
global $SCVersion;
echo "Tide script ".$SCVersion." by <a href=\"http://www.newtonandnoss.com/weather/\" target = \"_blank\">NewtonAndNoss.com</a>";
}
?>
Code: Select all
<HTML><BODY><PRE>
<P><center><font size=+2>Local Tide predictions</P></Center></font>
Southend Pier, Thames Rvr
Sheerness, England - READ flaterco.com/pol.html
+ Corrections: High(-0:10 -0.50) Low(-0:02 -0.70)
Units are meters
Monday 2011-01-31
Sunrise 7:37 AM GMTST, Sunset 4:43 PM GMTST
Moonrise 5:59 AM GMTST, Moonset 2:07 PM GMTST
Low Tide: 4:20 AM GMTST 1.1
High Tide: 10:21 AM GMTST 5.1
Low Tide: 4:50 PM GMTST 1.1
High Tide: 10:48 PM GMTST 5.1
Tuesday 2011-02-01
Sunrise 7:36 AM GMTST, Sunset 4:45 PM GMTST
Moonrise 6:32 AM GMTST, Moonset 3:17 PM GMTST
Low Tide: 5:21 AM GMTST 0.8
High Tide: 11:15 AM GMTST 5.3
Low Tide: 5:39 PM GMTST 1.0
High Tide: 11:37 PM GMTST 5.3
Wednesday 2011-02-02
Sunrise 7:34 AM GMTST, Sunset 4:47 PM GMTST
Moonrise 6:58 AM GMTST, Moonset 4:28 PM GMTST
Low Tide: 6:08 AM GMTST 0.6
High Tide: 12:02 PM GMTST 5.4
Low Tide: 6:18 PM GMTST 0.9
Thursday 2011-02-03 New Moon
Sunrise 7:32 AM GMTST, Sunset 4:49 PM GMTST
Moonrise 7:20 AM GMTST, Moonset 5:37 PM GMTST
High Tide: 12:18 AM GMTST 5.4
Low Tide: 6:47 AM GMTST 0.5
High Tide: 12:42 PM GMTST 5.4
Low Tide: 6:51 PM GMTST 0.9
Friday 2011-02-04
Sunrise 7:31 AM GMTST, Sunset 4:51 PM GMTST
Moonrise 7:38 AM GMTST, Moonset 6:46 PM GMTST
High Tide: 12:54 AM GMTST 5.4
Low Tide: 7:22 AM GMTST 0.4
High Tide: 1:18 PM GMTST 5.4
Low Tide: 7:22 PM GMTST 0.8
Saturday 2011-02-05
Sunrise 7:29 AM GMTST, Sunset 4:53 PM GMTST
Moonrise 7:54 AM GMTST, Moonset 7:54 PM GMTST
High Tide: 1:26 AM GMTST 5.4
Low Tide: 7:55 AM GMTST 0.4
High Tide: 1:51 PM GMTST 5.4
Low Tide: 7:54 PM GMTST 0.7
Sunday 2011-02-06
Sunrise 7:28 AM GMTST, Sunset 4:54 PM GMTST
Moonrise 8:09 AM GMTST, Moonset 9:00 PM GMTST
High Tide: 1:55 AM GMTST 5.5
Low Tide: 8:28 AM GMTST 0.4
High Tide: 2:23 PM GMTST 5.4
Low Tide: 8:26 PM GMTST 0.7
Monday 2011-02-07
Sunrise 7:26 AM GMTST, Sunset 4:56 PM GMTST
Moonrise 8:24 AM GMTST, Moonset 10:07 PM GMTST
High Tide: 2:25 AM GMTST 5.5
Low Tide: 8:59 AM GMTST 0.5
High Tide: 2:54 PM GMTST 5.3
Low Tide: 8:56 PM GMTST 0.8
Tuesday 2011-02-08
Sunrise 7:24 AM GMTST, Sunset 4:58 PM GMTST
Moonrise 8:41 AM GMTST, Moonset 11:14 PM GMTST
High Tide: 2:56 AM GMTST 5.4
Low Tide: 9:25 AM GMTST 0.6
High Tide: 3:25 PM GMTST 5.2
Low Tide: 9:23 PM GMTST 0.9
Wednesday 2011-02-09
Sunrise 7:22 AM GMTST, Sunset 5:00 PM GMTST
Moonrise 9:00 AM GMTST, Moonset 12:22 AM GMTST
High Tide: 3:28 AM GMTST 5.3
Low Tide: 9:47 AM GMTST 0.8
High Tide: 3:58 PM GMTST 5.1
Low Tide: 9:49 PM GMTST 1.0
Thursday 2011-02-10
Sunrise 7:20 AM GMTST, Sunset 5:02 PM GMTST
Moonset 12:22 AM GMTST, Moonrise 9:24 AM GMTST
High Tide: 4:03 AM GMTST 5.2
Low Tide: 10:09 AM GMTST 0.9
High Tide: 4:34 PM GMTST 4.9
Low Tide: 10:21 PM GMTST 1.1
Friday 2011-02-11 First Quarter Moon
Sunrise 7:19 AM GMTST, Sunset 5:04 PM GMTST
Moonset 1:30 AM GMTST, Moonrise 9:54 AM GMTST
High Tide: 4:45 AM GMTST 5.0
Low Tide: 10:45 AM GMTST 1.1
High Tide: 5:19 PM GMTST 4.7
Low Tide: 11:10 PM GMTST 1.3
Saturday 2011-02-12
Sunrise 7:17 AM GMTST, Sunset 5:05 PM GMTST
Moonset 2:36 AM GMTST, Moonrise 10:33 AM GMTST
High Tide: 5:37 AM GMTST 4.8
Low Tide: 11:45 AM GMTST 1.3
High Tide: 6:15 PM GMTST 4.6
Sunday 2011-02-13
Sunrise 7:15 AM GMTST, Sunset 5:07 PM GMTST
Moonset 3:37 AM GMTST, Moonrise 11:24 AM GMTST
Low Tide: 12:23 AM GMTST 1.4
High Tide: 6:47 AM GMTST 4.6
Low Tide: 1:05 PM GMTST 1.4
High Tide: 7:33 PM GMTST 4.5
Monday 2011-02-14
Sunrise 7:13 AM GMTST, Sunset 5:09 PM GMTST
Moonset 4:30 AM GMTST, Moonrise 12:28 PM GMTST
Low Tide: 1:51 AM GMTST 1.5
High Tide: 8:22 AM GMTST 4.6
Low Tide: 2:30 PM GMTST 1.4
High Tide: 9:03 PM GMTST 4.6
Tuesday 2011-02-15
Sunrise 7:11 AM GMTST, Sunset 5:11 PM GMTST
Moonset 5:14 AM GMTST, Moonrise 1:43 PM GMTST
Low Tide: 3:22 AM GMTST 1.3
High Tide: 9:43 AM GMTST 4.9
Low Tide: 3:51 PM GMTST 1.2
High Tide: 10:10 PM GMTST 5.0
Wednesday 2011-02-16
Sunrise 7:09 AM GMTST, Sunset 5:13 PM GMTST
Moonset 5:49 AM GMTST, Moonrise 3:06 PM GMTST
Low Tide: 4:40 AM GMTST 0.9
High Tide: 10:43 AM GMTST 5.3
Low Tide: 4:56 PM GMTST 0.9
High Tide: 11:03 PM GMTST 5.3
Thursday 2011-02-17
Sunrise 7:07 AM GMTST, Sunset 5:14 PM GMTST
Moonset 6:17 AM GMTST, Moonrise 4:32 PM GMTST
Low Tide: 5:36 AM GMTST 0.5
High Tide: 11:33 AM GMTST 5.6
Low Tide: 5:47 PM GMTST 0.7
High Tide: 11:51 PM GMTST 5.6
Friday 2011-02-18 Full Moon
Sunrise 7:06 AM GMTST, Sunset 5:16 PM GMTST
Moonset 6:41 AM GMTST, Moonrise 5:59 PM GMTST
Low Tide: 6:24 AM GMTST 0.3
High Tide: 12:20 PM GMTST 5.8
Low Tide: 6:33 PM GMTST 0.5
Saturday 2011-02-19
Sunrise 7:04 AM GMTST, Sunset 5:18 PM GMTST
Moonset 7:02 AM GMTST, Moonrise 7:26 PM GMTST
High Tide: 12:35 AM GMTST 5.8
Low Tide: 7:09 AM GMTST 0.1
High Tide: 1:06 PM GMTST 5.9
Low Tide: 7:18 PM GMTST 0.4
Sunday 2011-02-20
Sunrise 7:02 AM GMTST, Sunset 5:20 PM GMTST
Moonset 7:23 AM GMTST, Moonrise 8:53 PM GMTST
High Tide: 1:19 AM GMTST 5.9
Low Tide: 7:53 AM GMTST -0.0
High Tide: 1:50 PM GMTST 6.0
Low Tide: 8:02 PM GMTST 0.3
</PRE></BODY></HTML>
If you could try running the todaytide.php from within your browser and see if get results. And then try it in your custom page and see if you get the same results?