>From researching cheetah generator it looks like most of the python syntax carries over when outputting complex expressions using #echo. So I have tried a few python options, primarily variants of datetime or time.localtime() - timedelta(1) but they're not defined. I am not sure where I can import a module that will not be overwritten in upgrades. I tried adding the import to /usr/share/weewx/user/extensions.py but it doesn't seem to carry over. I have seen a few examples using time-86400, but I would have to define time in epoch values somewhere as well.
I've learned more python than when I first installed WeeWX, and I'm trying to bridge the gaps, but I'm just not there. Cheetah throws another kink in... and the user guide is less thorough than I would have hoped. Thank you in advance to any more suggestions on how to specify yesterday's date in the link either in skin.conf or index.html.tmpl! -Jonathan † On Sunday, September 16, 2018 at 2:30:20 PM UTC-5, Jonathan Zitelman wrote: > > Thanks! That generated the output I needed. I also figured out why you > got the 404 (aside from an extra slash)... the day is always 'yesterday'. > I tried to define yesterday with a timedelta, but can't figure out where I > would put that. I tried searching for a guide on cheetah on how I could > format strftime directly, but haven't been successful. Any other advice > would be very helpful! > > -JZ > > > On Sunday, September 16, 2018 at 1:11:09 PM UTC-5, Pat wrote: >> >> The Cheetah generator can use #echo to print >> <http://cheetahtemplate.sourceforge.net/docs/users_guide_html/users_guide.html#SECTION000810000000000000000> >> the >> date (and other things)... So you can try this in index.html.tmpl: >> >> >> #echo time.strftime('%Y%m%d')# >> >> So the full line would be: >> >> <img src="https://twc.tamu.edu/weather_images/rawsfcst/rawsfcst/#echo >> time.strftime('%Y%m%d')#.png"> >> >> >> Which gives me this output: >> >> <img src=" >> https://twc.tamu.edu/weather_images/rawsfcst/rawsfcst/20180916.png"> >> >> But that img returns a 404 for me, so I think you're missing something. >> Either way, hopefully this is enough to get you started. >> >> >> On Sunday, September 16, 2018 at 1:50:18 PM UTC-4, Jonathan Zitelman >> wrote: >>> >>> I am using the standard skin on WeeWX 3.8.0. I am trying to include a >>> link to a remote image, but the filename changes each day. I have >>> attempted adding it directly to index.html.tmpl using PHP (I know, not the >>> correct location): >>> >>> https://twc.tamu.edu/weather_images/rawsfcst/rawsfcst<?php echo >>> date(Ymd); ?>.png >>> >>> >>> But it does not look like there is a PHP parser. Next I added it into >>> the Extras section on skin.conf using direct python replacement, but it >>> does not parse correctly and spits out the actual code in the final HTML >>> document: >>> >>> https://twc.tamu.edu/weather_images/rawsfcst/rawsfcst' + >>> datetime.strftime.today().strftime('%Y%m%d') + '.png >>> >>> >>> Lastly I tried python using string replacement, and this seems to break >>> the skin.conf file: >>> >>> skin.conf Code: >>> >>> fire_date = datetime.strftime.today().strftime('%Y%m%d') >>> fire_img = "https://twc.tamu.edu/weather_images/rawsfcst/rawsfcst%s.png" >>> % (fire_date) >>> >>> >>> Error: >>> >>> reportengine: Failed to read skin configuration file >>> /etc/weewx/skins/Standard/skin.conf for report StandardReport: Parse error >>> in value at line 17. >>> >>> >>> Does anyone have suggestions on what code to use? Or if I should be >>> adding this in a different file? The file on the other site is always >>> "rawsfcstYYYYMMDD.png" and I just need to parse out the date in the report. >>> >>> -Jonathan † >>> >>> -- 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.