My apologies Thomas, my logic was reversed and you are quite correct about 
the almanac moon phase tags; I had clearly been staring at the almanac for 
too long, will teach me to reply early in the morning! i should also have 
pointed out the code was untested.

Looking at your template you can cut down you code a lot as there is a lot 
of repetition. If you make use of the $almanac.moon_fullness tag to 
directly construct your file name you can greatly simply your code. 
Something like this should do what you want:

<br>$almanac.next_full_moon</br>
                                </div>
                                <div class="col-sm-7 moon">
                                    <table  style="text-align: left; margin-
left: 9px; width: 106px; height: 60px; border="0" cellpadding="2" 
cellspacing="2">
                                        <tbody>
                                            <tr>
                                            #if $almanac.moon_fullness == 0
                                                ## we have a new moon
                                                <td style="width: 51px;" 
colspan="1" rowspan="2"><img style="width: 50px; height: 50px;" title="Neumond 
| $almanac.moon_fullness%" src="$station.station_url/images/moon/0.png"
></td>
                                            #else if $almanac.moon_fullness 
== 100
                                                ## we have a full moon
                                                <td style="width: 51px;" 
colspan="1" rowspan="2"><img style="width: 50px; height: 50px;" 
title="zunehmende 
Mondsichel | $almanac.moon_fullness%" src=
"$station.station_url/images/moon/100.png"></td>
                                            #else if 
$almanac.next_full_moon.raw > $almanac.next_new_moon.raw
                                                ## we have a waning moon
                                                <td style="width: 51px;" 
colspan="1" rowspan="2"><img style="width: 50px; height: 50px;" 
title="zunehmende 
Mondsichel | $almanac.moon_fullness%" src=
"$station.station_url/images/moon/${almanac.moon_fullness}.png"></td>       
             
                                            #else
                                                ## we have a waxing moon
                                                #set $file_name = (100 - 
$almanac.moon_fullness) + 100
                                                <td style="width: 51px;" 
colspan="1" rowspan="2"><img style="width: 50px; height: 50px;" 
title="zunehmende 
Mondsichel | $almanac.moon_fullness%" src=
"$station.station_url/images/moon/$file_name.png"></td>                    
                                            #end if
                                                <td><img style="width: 20px; 
height: 10px; title="Aufgang" src="$station.station_url/images/rise.png">
</td>
                                                <td style="width: 
1px;">$almanac.moon.rise.format("%H:%M 
%p")</td>
                                            </tr>
                                            <tr>
                                                <td><img style="width: 20px; 
height: 10px; title="Untergang" src="$station.station_url/images/set.png">
</td>
                                                <td style="width: 
1px;">$almanac.moon.set.format("%H:%M 
%p")</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            <div class="clear"></div>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>

This time I have run this code and I think it does what you want.

Gary          

On Tuesday, 6 November 2018 06:27:02 UTC+10, Thomas Sch wrote:
>
>
>
> Am Montag, 5. November 2018 21:14:18 UTC+1 schrieb Thomas Sch:
>>
>> So I tested your solution but it says Waxing Moon. But we have waning 
>> Moon currently. 
>>
>> And $almanac.moon.next_full_moon.raw / $almanc.moon.next_new_moon.raw 
>> didnt Work. I Gott the Error: cannot find "next_full_moon" while searching 
>> for "almanac.moon.next_full_moon.raw"
>>
>> I Had to use $almanac.next_full_moon.raw / $almanac.next_new_moon.raw. 
>>
>> In my best post I will Show you What I tryed.
>>
>
> With moon.html.tmpl I tested your solution gjr80. moon.html = output
> with test.html.tmpl I tested my current solution. test.html = output 
>

-- 
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 weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to