So, this is my approach.
<script>
setInterval("reload_hook();", 10000);
function reload_hook () {
$.get('./hooks/hook_after_station_info.html', function(data) {
\$('#target_after_station_info').html(data);
})
}
</script>
This script replaces later in the index.html a certain content by the content of the file hook_after_station_info.html in the subfolder 'hooks'. The replacement is done every 10000 milliseconds.
In the same index.html.tmpl file I've replaced the code, that manages the content of the "index_hook_after-station_info" by the following:
#if os.path.exists("index_hook_after_station_info.inc")
<!-- Start of index_hook_after_station_info row -->
<div class="row index-hook-after-station-info border-bottom">
<div id="target_after_station_info">
#include "index_hook_after_station_info.inc"
</div>
</div>
<!-- End of index_hook_after_station_info row -->
#end if
In the index_hook_after_station_info.inc I've put the HTML code that should be displayed on the page. In my case the file contains a couple of custom calculations of variables and then the following html code:
<br>
<p align="center" style="font-size:24px">
$suntext $raintext
<br>
</p>
<br>
The last missing part is the file that is used to update the index hook.
As mentioned above, this file is stored in the subfolder 'hooks'. So create this subfolder in your Belchertown folder and create a file called 'hook_after_station_info.html.tmpl'. The content of this file is identical to the content of the index_hook_after_station_info.inc
Finally you have to tell Belchertown, that this file has to be produced every time the skin is produced. This can be done in the skin.conf file.
Under [CheetahGenerator] add:
[[[hooks]]]
template = hooks/hook_after_station_info.html.tmpl
This approach leads to the desired behavior (i.e. the index hook updates automatically). But I'm definitely not an experienced web-programmer. I'm pretty sure there is a more elegant way of doing it. There's for example no reason for having two separate file with the code for the index_hook. This easily could be done with just one file.
Hope this works for you. In case you have any questions, please let me know.
Best,
Manfred