Page 1 of 1

[SOLVED]Problem with HTML custom block

Posted: Friday 10 September 2021 10:26
by Diplo95
Hi,

I'm a beginner with dashticz and I try to use an HTML custom block on my screen. I use the example of the wiki and try to retrieve the met of my location.

Here is the code from weatherwidget.io :

Code: Select all

<a class="weatherwidget-io" href="https://forecast7.com/fr/48d542d66/melun/" data-label_1="Moissy-Cramayel" data-icons="Climacons Animated" data-mode="Current" data-theme="pure" >Moissy-Cramayel</a>
<script>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='https://weatherwidget.io/js/widget.min.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','weatherwidget-io-js');
</script>
I created the file WeatherwidgetMelunCurrent.html in /home/pi/Dashticz/Program/custom

Then, I created my block :

Code: Select all

blocks['weatherwidgetCurrent'] = {
    htmlfile: 'WeatherwidgetMelunCurrent.html',
	width: 6,
	title: 'Melun'
}
And finally, I put it in a column :

Code: Select all

columns = {}

columns[1] = {}
columns[1]['blocks'] = ['weatherwidgetCurrent']
columns[1]['width'] = 6;
Here is the result :
Image

Any idea where I go wrong ?
Thx

Re: Problem with HTML custom block

Posted: Friday 10 September 2021 18:18
by Lokonli
Diplo95 wrote: Friday 10 September 2021 10:26 Hi,

I'm a beginner with dashticz and I try to use an HTML custom block on my screen. I use the example of the wiki and try to retrieve the met of my location.

Here is the code from weatherwidget.io :

Code: Select all

<a class="weatherwidget-io" href="https://forecast7.com/fr/48d542d66/melun/" data-label_1="Moissy-Cramayel" data-icons="Climacons Animated" data-mode="Current" data-theme="pure" >Moissy-Cramayel</a>
<script>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='https://weatherwidget.io/js/widget.min.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','weatherwidget-io-js');
</script>
I created the file WeatherwidgetMelunCurrent.html in /home/pi/Dashticz/Program/custom

Then, I created my block :

Code: Select all

blocks['weatherwidgetCurrent'] = {
    htmlfile: 'WeatherwidgetMelunCurrent.html',
	width: 6,
	title: 'Melun'
}
And finally, I put it in a column :

Code: Select all

columns = {}

columns[1] = {}
columns[1]['blocks'] = ['weatherwidgetCurrent']
columns[1]['width'] = 6;
Here is the result :
Image

Any idea where I go wrong ?
Thx
The htmlfile parameter is relative to the Dashticz custom folder ./custom

So your custom html file might be in the wrong location. (or is Program the name of your Dashticz folder?)

Naming is case sensitive. So you should check that as well.

Re: Problem with HTML custom block

Posted: Friday 10 September 2021 18:32
by Diplo95
Hi,

Image

I used the automatic installation, and I don't remember the path I chose. But, as you can see, this is the folder containing my CONGIG.js and custom.css files.

Re: Problem with HTML custom block

Posted: Friday 10 September 2021 18:41
by Diplo95
I found my stupid error :
I had defined the weatherwidget blocks before the line

Code: Select all

blocks{}
in CONFIG.js !!!