Hi there
Is there a way to extarct a line from Testtags.php?
I know that i can make a custome tag in WD called ???.html and put the tag in there, but as testtags has this already listed, can I extract the value into a php file.
Not a problem. The $whatever values in testtags.php are already global variables and you can use them in files with impunity. That’s where i get aqi information on my main page.
Jim
Yes, it depends on what you want to use from that file.
It is a large .php file with over 500 lines.
Use an include 'testtags.php'
inside a function() and “export” the fields needed from that function.
Otherwise there will be conflicts with texttags-fieldnames which can be used in the dashboard also
For instance, if you want to use a 2 items from that file in a PWS_Dasboard block:
$my_field1 = '';
$my_field2 = '';
function load_from_testags()
{ global $my_field1, $my_field2;
include 'testtags.php';
$my_field1 = $moonage;
$my_field2 = $moonphase;
return; }
load_from_testags();
# for test
echo '$my_field1 = '.$my_field1.'<br />';
echo '$my_field2 = '.$my_field2;
Result with my old testtags.php file
$my_field1 = Moon age: 23 days,19 hours,22 minutes,33%
$my_field2 = 33%
Hope this helps,
Wim
I guess Wim’s answer depends on whether you are using it in Saratoga or pwsWD. My answer applied to Saratoga.
Jim
This will be for a PWS Dashboard, and its only the max solar for the day and time.
Can i use the script above WIM to do this please?
Thanks
Steve
Yes,
You need to check your testtags.php which fields you want to use.
I found these:
$highsolar = "832"; // Daily high solar (for Davis VP and Grow stations)
$highuv = "6.8"; // Daily high UV (for Davis VP stations)
$highsolartime = "12:56 PM"; // Time that the daily high solar occured
Succes,
Wim,
Sadly your testags.php has an PHP 500 error.
https://www.hytheweather.co.uk/_test.php?test=testtags.php
Line 13-15 reads
// Version 1.07 - 23-Jul-2011 -- added support for multiple plugin scripts for WD - see comments for supported
scripts
/*
The word scripts on line 14 should be on the previous line.
Similar errors on lines 87-93
$morningciviltwilight = '6:18 am'; // morning civil twilight time (when the sun is 6 degrees below the
horizon)
$eveningciviltwilight = '5:59 pm'; // evening civil twilight time
$morningastrotwilight = '5:02 am'; // morning astronimcal twilight time (when the sun is 12 to 18
degrees below the horizon)
$eveningastrotwilight = '7:16 pm'; // evening astronimcal twilight time (when the sun is 12 to 18
degrees below the horizon)
on lines 135,138 and dozens other lines.
Better download a correct testags.txt file and add it to your WeatherDisplay environment.
Succes,
Wim
Only problem I can see is that testtags.php (for Saratoga, anyway) is usually only uploaded every 5 minutes. For pwsWD I use a customtext.txt file uploaded every minute (as customtextout.txt).
testtags is uploaded to another folder so might be using a customefieldout as BOS said.
Can you not just specify the address?
Re customtextout, see HWS-template (WD34) July version available - #93 by bitsostring