Tides Processor Script

I have just discovered a possible bug in the tides processing script. I create a file outside of WD which does 365 days of tides. When displaying the next 20 days of tide or sunrise/sunset information for some reason it displays Sunday 25th October twice. You can see the output here and you can see the file it is using as input here. The input file does not contain two copies of the 25th, also it does not matter which start day you use it still shows the two copies of the 25th, so it is not a function of which day is being displayed.

I’ll try to look at the code later today and see if I can fix it. Looking at others pages it does not seem to happen so it could be my mods which allow a change of start date but I’ll see later. Just thought I’d post in case anyone using the basic script is seeing this!

Stuart

Edit: Just been looking at the code and I think this has to do with daylight saving, the code uses 86400 seconds to add to get to the next day and this does not work reliably when you hit the fall back of DST. Dont know if I’m using an old version of the script as mine has changes to highlight tide heights etc. Need to look at current version now.

Edit: Just looked and I have the latest script, so its probably that I’m using PHP V5.3.0 now and something has changed there. I suspect this will be an issue for others in the future.

OK I think I’ve fixed this, at least one way there may be a better was. The problem seems to be that strtotime or date (not sure which) works slightly differently now at PHP 5.3. The problem is that if you add 86400 seconds to the time when you get to the 25th October (DST changeover day) it does not step over to the 26th properly as the 25th is more than 86400 seconds. Anyway in order to resolve it for me I force the processing date to be set to midday which in turn ensures that adding 86400 seconds gets it to step forward correctly from 25th October. Not sure I’ve explained that very well :roll: Anyway it works for me now.

Stuart

The tides_processor.php setup download says to:

Set the server path to your tideprediction.html file //
$tidefile = “…/weather/tideprediction.html”;

But the software does not have $tidefile = but instead has this? What do I do?

// Get tide file
error_reporting(0);
$tideD = implode(‘’, file($tidefile));
if ($tideD == false)

Wondering if someone could take a look and see what is causing my script to not update and/or fill in the tabs.

I am able to get the table to show in the page I created: www.kingsparkweather.com/wxtides.php

I have WD uploading the predictions file and I can see it has data in it: www.kingsparkweather.com/tideprediction.html

I feel I have everything configured correctly in tides_processor.php : see attachment.

Just can’t seem to get the fields to populate in the chart on the page.

Thanks in advance for any help with this.

Bobby


tides_processor.txt (15.1 KB)

Try changing this to the full file path of your server, see if it helps.

//   Set the server path to your tideprediction.html file                       //
$tidefile = "./tideprediction.html";  

I have tried “./tideprediction.html”; - “…/tideprediction.html”; - “www.kingsparkweather.com/tideprediction.html”;

I either get the unpopulated boxes or I get boxes full of the updating message…

Thanks for the input though…

No I mean the entire file path…something like /web/1234.5678/htdoc/tideprediction.html

Put this into a file called path.php and upload it to your web root. Open it up and it should tell you what your file path is…

<?php echo dirname(__FILE__);?>

Jack

I don’t know what I did but it’s WORKING! Actually, I uploaded a fresh copy of tide_processor.php, changed the directory (To what I was already using) and it worked.

Now I just need to work on the graph size and position :slight_smile:

www.kingsparkweather.com/wxtides.php

Whew! Finally!

http://www.oldlineweather.com/wxtides.php

Thanks for all of the direction and support.

Hi,

Been trying to get the the script to work for several hours now but not having any success. Hope someone can find the problem that may be preventing the script from working. The tideprediction.html file is populated fine with the correct info but just can’t get the tide table to show. I have tried several paths for “./tideprediction.html” file but that doesn’t seem to be the problem.

Page is located at www.carolinastormwatch.com/wxtidetable.php to see my lack of data showing.

Attached are the tide_processor.txt and wxtidetable.txt files.

Hope someone can find where my mistake may be. #-o

many thanks!!

Tom


tides_processor.txt (15.1 KB)

wxtide.txt (5.67 KB)

Would help if we could see the wxtidetable.php source as well please…

Stuart

Hi Stuart,

It is actually attached to the last post as wxtide.txt; I mistakenly named it to wxtide.txt when renaming the php file. Renamed and attached again.

Thanks…


wxtidetable.txt (5.65 KB)

There’s something wrong with the file locations that you have in the scripts.
Do you have both tideprediction.html and tide_processor.php in the root folder of your website, where the likes of index.php is?

If so then in the tide_processor.php file change

//   Set the server path to your tideprediction.html file                       //
$tidefile = "../tideprediction.html";                                   //

To this:

//   Set the server path to your tideprediction.html file                       //
$tidefile = "./tideprediction.html";                                   //

You’ll see that I’ve removed one of the “.” as the one you have there now is telling the script to look two files up in the server tree and this will take it outside the website root file.

Hi Martin,

I have tried “./tideprediction.html”, “…/tideprediction.html” and finally the server path “. /services1/webpages/c/a/carolinastormwatch.com/public/tideprediction.html”, and the table is now showing but the tide data will not display.

Now I am getting the following message in each cell in the table: “Tide data is being updated. Please refresh the page”. Refreshing the page is not producing any results. The tideprediction.html file has the latest tide info in it.

www.carolinastormwatch.com/wxtidetable.php

Strange, haven’t read about anyone else having this issue. Getting the table now but the tide info is just not being populated.

Anyone have any ideas?? At least with the server path the table is being created but is just not showing the tide data. #-o

Files are attached.


tides_processor.txt (15.2 KB)

wxtide.txt (5.67 KB)

In your wxtidetable.php file, try moving the following code above the tag.

<?php
require_once("./tides_processor.php");
?>

Thanks for the help Martain but that doesn’t do it. The Tide Table goes back to not displaying anything. Even tried the server path as suggested in the instructions above (/head) and I get a blank page.

To answer a question in your earlier post; my files are located in my root.

Has to be something simple here that I am just not getting correct.

Try this in your tides_processor.php

$tidefile = "./tideprediction.html";  

and in your wxtide.php page:

<?php
require_once("tides_processor.php");
?>

Success!!! Many thanks to Budgie and Micheal for your assistance!!! Excellant scprit and great directions that I guess I was trying to make harder than it should have been. Just have to clean some things up now.

Thanks guys!!!

Tom

Hi,

Finally got the tide_processor script working with the assistance of Michael and Martin but for some reason my moon icons are just not showing.

http://www.carolinastormwatch.com/wxtidetable.php

I have tried different relative paths as suggested but the icons just aren’t showing; although I am not getting a “red X” for a broken link. When I click on on the icon properties it is showing the link as: “http://www.carolinastormwatch.com/icons/tide_moonlastQ.gif” which should be correct.

Any ideas/suggestions would be greatly appreciated!

Tom