Got it - I'd like to keep it as simple as possible. I guess I thought that if the .inc file was missing, then weewx would throw an exception. So by doing it in the SLE, if file doesn't exist it can handle that.
I'll do some testing and simplify it if possible! On Saturday, December 22, 2018 at 8:15:56 PM UTC-5, Thomas Keffer wrote: > > It's entirely up to you, but it sure is simpler than your dynamic loading > in the SLE's! > > BTW, there's nothing special about the ".inc" extension (nor the ".tmpl" > extension). They're just a WeeWX convention. > > -tk > > On Sat, Dec 22, 2018 at 5:10 PM Pat <[email protected] <javascript:>> > wrote: > >> Oh, I'm using the #inc directive already >> <https://github.com/poblabs/weewx-belchertown/blob/master/skins/Belchertown/index.html.tmpl#L10>. >> >> But not with *.inc files. Your suggestion is to #inc the .inc's? >> >> On Saturday, December 22, 2018 at 7:46:40 PM UTC-5, Thomas Keffer wrote: >>> >>> See the #include >>> <https://pythonhosted.org/Cheetah/users_guide/output.html#include> >>> directive in the Cheetah manual for details. >>> >>> If you're going to be working much with skins, it's worth looking >>> through the Cheetah manual. There's lots of cool stuff in there! >>> >>> -tk >>> >>> On Sat, Dec 22, 2018 at 7:21 AM Pat <[email protected]> wrote: >>> >>>> This is an interesting question because I didn't know Cheetah could >>>> handle .inc files natively. So I've been processing them as part of >>>> the SLE seen here >>>> <https://github.com/poblabs/weewx-belchertown/blob/master/bin/user/belchertown.py#L116-L170> >>>> . >>>> >>>> Which is why I said I don't think the Belchertown skin can do tags >>>> within the inc because I'm doing it differently. With that said maybe what >>>> I'm doing is overkill? >>>> >>>> >>>> On Thursday, December 20, 2018 at 7:34:10 PM UTC-5, Colin Larsen wrote: >>>>> >>>>> That makes a lot of sense, I'll have a play with changing it around. >>>>> >>>>> Cheers >>>>> Colin >>>>> >>>>> On Friday, 21 December 2018 13:15:39 UTC+13, Thomas Keffer wrote: >>>>>> >>>>>> Yes, there is more than one way to do it. >>>>>> >>>>>> However, it's important to note that the end result is not the same. >>>>>> If you do a Cheetah #include directive (my suggestion, and what the >>>>>> Seasons >>>>>> skin does), the page is included *at template processing time*. >>>>>> You'll end up with a single HTML page with all the content. >>>>>> >>>>>> By contrast, your approach includes the file *at runtime* in the >>>>>> client. It will involve an extra HTTP fetch to get the second HTML file. >>>>>> >>>>>> -tk >>>>>> >>>>>> On Thu, Dec 20, 2018 at 3:42 PM Colin Larsen <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> Ok found it solution - sorry Pat, answering my own question but >>>>>>> other may be interested :) >>>>>>> >>>>>>> First I created a tmpl file with the tags I wanted (I called it >>>>>>> stationinfo.html.tmpl) and saved that in the skins/Belchertown directory >>>>>>> >>>>>>> I then edited skin.conf to include the new tmpl file, just below the >>>>>>> [[[about]]] I added >>>>>>> >>>>>>> [[[stationinfo]]] >>>>>>> >>>>>>> template = stationinfo.html.tmpl >>>>>>> >>>>>>> This generated my html file in the web root directory >>>>>>> >>>>>>> I then used this script that I found in my inc file >>>>>>> >>>>>>> <html> >>>>>>> <head> >>>>>>> <script src="jquery.js"></script> >>>>>>> <script> >>>>>>> $(function(){ >>>>>>> >>>>>>> $("#includedContent").load("http://41south.net.nz/stationinfo.html"); >>>>>>> }); >>>>>>> </script> >>>>>>> </head> >>>>>>> >>>>>>> <body> >>>>>>> <div id="includedContent"></div> >>>>>>> </body> </html> >>>>>>> >>>>>>> >>>>>>> Voila - I have the information in the inc section . :) >>>>>>> >>>>>>> I'm sure there are some grammatical errors here so far as html goes, >>>>>>> but it works >>>>>>> >>>>>>> Cheers >>>>>>> Colin >>>>>>> >>>>>>> On Friday, 21 December 2018 12:27:14 UTC+13, Pat wrote: >>>>>>>> >>>>>>>> Hmm. I don't think so, but let me look into it. >>>>>>>> >>>>>>>> On Thursday, December 20, 2018 at 5:50:54 PM UTC-5, Colin Larsen >>>>>>>> wrote: >>>>>>>>> >>>>>>>>> Hi all >>>>>>>>> >>>>>>>>> Quick group question as my html skills are not fantastic; >>>>>>>>> >>>>>>>>> Pat has made available some 'inc' pages to put custom code >>>>>>>>> sections in various places on his skin. Full html code works fine and >>>>>>>>> I've >>>>>>>>> put together an alternative 3 day forecast section already to replace >>>>>>>>> Darksky, which is for some reason inaccurate down here. >>>>>>>>> >>>>>>>>> My question is, how would I put Weewx tags into one of these >>>>>>>>> pages? I assume it would require a tmpl file with the tags which is >>>>>>>>> then >>>>>>>>> included in Pats inc file - sort of nested html? >>>>>>>>> >>>>>>>>> Any pointers appreciated >>>>>>>>> >>>>>>>>> Cheers >>>>>>>>> Colin >>>>>>>>> >>>>>>>> -- >>>>>>> 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 [email protected]. >>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>> >>>>>> -- >>>> 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 [email protected]. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- >> 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 [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
