Thanks for your replies. I managed to get a good result just using HTML
and Javascript, without having to interfere with any conf files or with any
of the Python code. This is what worked:
1. Capturing $current.forecastRule.raw with index.html.tmpl which passed
that value as an integer to index.html at the time of archive generation
2. Placing all the relevant variables and strings into an external
Javascript file in the same html directory
3. Getting the syntax right to ensure that the forecast integer was used
by the script to place the right text on the page
Here's the relevant bit of forecast_text.js as in (2) above:
var myElement = document.getElementById("code");
var forecast = [
"Mostly clear and cooler",
"Mostly clear with little temperature change",
"Mostly clear for 12 hours with little temperature change",
...
];
document.getElementById("code").innerHTML = forecast[myElement.innerHTML];
and here's the relevant bit of html as in (3) above:
<p>$current.forecastRule.raw</p>
<p id="code">$current.forecastRule.raw</p>
<script type="text/javascript" src="forecast_text.js">
</script>
Happy to share the full files if anyone's interested. Result (currently)
visible at http://www.pjd.com.au/weewx/dashboard/ (though I'm still
displaying the integer code as well as the text till I am sure it's all
working normally).
PJD
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/63145e6e-4021-4063-8e37-8cf8e5c113db%40googlegroups.com.