Page 1 of 1

Gauges in a different directory code

Posted: Mon 06 Jun 2016 11:24 am
by JacquesSteventon
Hi all,

I run a website (www.dorsetliveweather.co.uk).

I have gauges running on the first page. I am making a mobile/app website page for any android user or smartphone device.

Easily enough I can just copy and paste the text from gauges-ss.htm into my index.html and it will display the gauges. I have another directory /app which I would like to display the gauges but putting the code - <div class="row">
<div class="gauge">
<div id="tip_0">
<center><canvas id="canvas_temp" class="gaugeSizeStd"></canvas><canvas id="canvas_dew" class="gaugeSizeStd"></canvas></center>
</div>
<input id="rad_temp1" type="radio" name="rad_temp" value="out" checked onclick="gauges.doTemp(this);"><label id="lab_temp1" for="rad_temp1">Outside</label>
<input id="rad_temp2" type="radio" name="rad_temp" value="in" onclick="gauges.doTemp(this);"><label id="lab_temp2" for="rad_temp2">Inside</label>
</div>


For example doesn't work.

Any ideas?

Many Thanks

Re: Gauges in a different directory code

Posted: Mon 06 Jun 2016 11:35 am
by steve
Your html page needs to load the required javascript files, as you've done on your index.html page.

Re: Gauges in a different directory code

Posted: Mon 06 Jun 2016 12:38 pm
by JacquesSteventon
Hi Steve,

Thanks for the reply. I have done what you said and the gauges are now appearing which is great. Could you have a look at dorsetliveweather.co.uk/app/index.html source code and see if I am doing something wrong because I can't seem to get the gauges to show any data although they are displaying.

Thank you

Re: Gauges in a different directory code

Posted: Mon 06 Jun 2016 12:49 pm
by steve
It's looking in the wrong place for the realtimegauges.txt file; you're using the same gauges.js files, and that has a relative URL in it which only works for your other pages. I would imagine that a full URL would work in there instead, so it works no matter where it's called from.