Page 1 of 1

Sea temperature Block

Posted: Sun Jan 08, 2023 6:01 am
by leonrossouw
The block seems broken ?
Any ideas on fixing it ?
2D76B386-02B0-4F7F-882C-7E21784A9E07.png
2D76B386-02B0-4F7F-882C-7E21784A9E07.png (54.13 KiB) Viewed 8626 times

Re: Sea temperature Block

Posted: Mon Jan 09, 2023 3:29 pm
by Asobig
It seems that that they changed the output of the json-file, to make it work i changed the following things in the block:
Remove line 90 to 95, so this part:

Code: Select all

for($i=0;$i<count($data);$i++){
		$data[$i]['current'] = number_format(convertor($data[$i]['current'],"C",$displayTempUnits),1,".","");
		$data[$i]['thisMonthMax'] = number_format(convertor($data[$i]['thisMonthMax'],"C",$displayTempUnits),1,".","");
		$data[$i]['thisMonthAvg'] = number_format(convertor($data[$i]['thisMonthAvg'],"C",$displayTempUnits),1,".","");
		$data[$i]['thisMonthMin'] = number_format(convertor($data[$i]['thisMonthMin'],"C",$displayTempUnits),1,".","");
	}
Change line 117 from:

Code: Select all

<?php echo floor($data[$i]['current'])?>.<span style="font-size:0.6em"><?php echo number_format(($data[$i]['current'] - floor($data[$i]['current']))*10,0,".","")?>&nbsp;<?php echo unitFormatter($displayTempUnits)?></span>
To:

Code: Select all

<?php echo $data[$i]["current"];?>&nbsp;<?php echo unitFormatter($displayTempUnits)?></span>
Change lines 134 to 138, from:

Code: Select all

<td style="width:33%"><?php echo lang('maximumAbbr','c')?><br><?php echo floor($data[$i]['thisMonthMax'])?>.<span style="font-size:0.7em"><?php echo number_format(($data[$i]['thisMonthMax'] - floor($data[$i]['thisMonthMax']))*10,0,".","")?>&nbsp;<?php echo unitFormatter($displayTempUnits)?></span>
</td>
<td style="width:33%"><?php echo lang('avgAbbr','c')?><br><?php echo floor($data[$i]['thisMonthAvg'])?>.<span style="font-size:0.7em"><?php echo number_format(($data[$i]['thisMonthAvg'] - floor($data[$i]['thisMonthAvg']))*10,0,".","")?>&nbsp;<?php echo unitFormatter($displayTempUnits)?></span>
</td>
<td style="width:33%"><?php echo lang('minimumAbbr','c')?><br><?php echo floor($data[$i]['thisMonthMin'])?>.<span style="font-size:0.7em"><?php echo number_format(($data[$i]['thisMonthMin'] - floor($data[$i]['thisMonthMin']))*10,0,".","")?>&nbsp;<?php echo unitFormatter($displayTempUnits)?></span>
To:

Code: Select all

<td style="width:33%"><?php echo lang('maximumAbbr','c')?><br><?php echo $data[$i]['thisMonthMax']?>&nbsp;<?php echo unitFormatter($displayTempUnits)?></span>
</td>
<td style="width:33%"><?php echo lang('avgAbbr','c')?><br><?php echo $data[$i]['thisMonthAvg']?>&nbsp;<?php echo unitFormatter($displayTempUnits)?></span>
</td>
<td style="width:33%"><?php echo lang('minimumAbbr','c')?><br><?php echo $data[$i]['thisMonthMin']?>&nbsp;<?php echo unitFormatter($displayTempUnits)?></span>
</td>
I tested it only with Celsius!

Re: Sea temperature Block

Posted: Tue Jan 10, 2023 12:56 pm
by leonrossouw
Thank you very much !
Works perfectly
:D
Regards,
Leon

Re: Sea temperature Block

Posted: Wed Jan 11, 2023 9:24 am
by Laglene
Hello, I also had the same problem. Great, thanks to your explanations it works...
thanks a lot for your help

Re: Sea temperature Block

Posted: Tue Jan 17, 2023 6:23 pm
by alexvanuxem
thx it works, could you make an 'official' update block? @davidefa, thx!!!

Re: Sea temperature Block

Posted: Wed Jan 18, 2023 1:08 am
by cw3beck
Thanks! Worked for me as well. Cheers!

Re: Sea temperature Block

Posted: Fri Jan 27, 2023 4:51 pm
by MeteoElMasnou
Hello,
I followed all the steps you indicate and I can't get it to work.

Could you post the modified seaTemperatureBlock.php file?

Thank you

Re: Sea temperature Block

Posted: Fri Jan 27, 2023 9:37 pm
by Asobig
Here is the (zipped) php file.
I hope it works:
https://www.asobig.com/uploads/seaTempe ... ck.php.zip

Re: Sea temperature Block

Posted: Thu Feb 02, 2023 9:28 am
by MeteoElMasnou
Asobig wrote: Fri Jan 27, 2023 9:37 pm Here is the (zipped) php file.
I hope it works:
https://www.asobig.com/uploads/seaTempe ... ck.php.zip
Great, working.
Thank you