Author Topic: Issue with the icons in the Saratoga Weather NWS Forecast Script  (Read 284 times)

0 Members and 1 Guest are viewing this topic.

Offline Gonzo1982

  • Member
  • *
  • Posts: 8
Hello,

I'm having an issue with the icons in the saratoga weather nws forecast script.  If I call the script from inside my wordpress website, the images don't show, https://coffeesevereweather.com/current-forecast/.  But if I call the script by going straight to it, https://coffeesevereweather.com/advforecast2.php, it works fine.  Any ideas?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6750
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Issue with the icons in the Saratoga Weather NWS Forecast Script
« Reply #1 on: April 16, 2018, 11:04:27 AM »
It's due to the WordPress site and the scripts aren't really designed to handle how WordPress tweaks about with the URL:filesystem path mappings.

The easiest way to get it to work in a WP page is to use an <iframe> to reference the content where you know it works (your document root).

Something like
Code: [Select]
<iframe src="https://coffeesevereweather.com/advforecast2.php" width="620" height="1024" scrolling="no">
</iframe>
on your /current-forecast/ WP page.  You may have to adjust the height to get it all to fit without scrollbars.

The advforecast2.php script could likely be used on your main index.php setup, but not in a sub-page due to the relative directory addressing.

Hope this helps...
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Gonzo1982

  • Member
  • *
  • Posts: 8
Re: Issue with the icons in the Saratoga Weather NWS Forecast Script
« Reply #2 on: April 16, 2018, 11:10:17 AM »
Thanks, That gets me going for now.  I'll keep messing with calling the script.  Maybe I can get it working.  Thanks for your scripts btw.  Using the GR3 radar and now the forecast, both are very useful.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6750
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Issue with the icons in the Saratoga Weather NWS Forecast Script
« Reply #3 on: April 16, 2018, 11:19:07 AM »
Keep in mind that for advforecast2.php to work correctly, the URL-path and Filesystem-path need to match.  That is:

advforecast2.php
DualImage.php
./forecast/images/*
./forecast/icon-templates/*

need to have that filesystem and URL-path setup to operate properly.  By 'match' I mean that
http://your.website.com/  maps to /home/somepath/httpdocs
http://your.website.com/forecast/images/skc.jpg  maps to /home/somepath/httpdocs/forecast/images/skc.jpg
etc.  WordPress does funny internal mapping so the URL-path and filesystem path for the real file don't always match and that breaks the script.

Oh, and don't change the internal addressing in advforecast2.php from relative filesystem addressing (./forecast/images) to URL addressing (https://...) -- it will break the script in other ways.
« Last Edit: April 16, 2018, 11:21:10 AM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Gonzo1982

  • Member
  • *
  • Posts: 8
Re: Issue with the icons in the Saratoga Weather NWS Forecast Script
« Reply #4 on: April 16, 2018, 11:24:02 AM »
Alright, I feel like I should be able to get this fixed somehow.  On your GR3 script, it's pulling the radar images from a separate folder, like /gr3/khtx_br1_0.jpg and that's loading fine in WordPress, https://coffeesevereweather.com/real-time-radar/

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6750
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Issue with the icons in the Saratoga Weather NWS Forecast Script
« Reply #5 on: April 16, 2018, 11:45:15 AM »
The GRlevel3 radar script does some funny stuff (of which I'm not proud) to try and suss out the URL address of /GR3 with the filesystem address of the same.  It is the only script of mine that does that, and I don't recommend trying to clone that method into advforecast2.php.

A simpler approach (if you have SSH access to your website) is to create a symlink inside the /current-forecast/ directory to where the 'real' forecast directory is like
Code: [Select]
cd httpdocs/current-forecast
ln -s ../forecast forecast
ln -s ../advforecast2.php advforecast2.php
ln -s ../DualImage.php DualImage.php

Then have the page do the equivalent (in WordPress) of
Code: [Select]
include("advforecast2.php"); and the page should display completely and be happy with the subdirectory placement of the WP page.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Gonzo1982

  • Member
  • *
  • Posts: 8
Re: Issue with the icons in the Saratoga Weather NWS Forecast Script
« Reply #6 on: April 17, 2018, 10:33:57 AM »
I was able to make the iframe work by messing with the css to change the colors to match my theme.  One question though, is there a way to remove all of the dead white space to the right or center the content to the page?

 

anything