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.
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
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.
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.
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.
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.
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.
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!