nikola Posted July 18, 2013 Share Posted July 18, 2013 Hi guys, It's been a while that I've posted here on the forum, the reason was - I got a new job few months ago so I've been rather busy and haven't got time to post some new things. I've made a Yahoo! Weather module that connects to Yahoo weather API and pulls current forecast and forecast for next 4 days. The module is completely ready for translation, I've also made days and weather conditions translatable because Yahoo API doesn't offer localization (English only). The widget has normal mode and compact mode and you can easily customize it's appearance through included CSS. Edit 12.04.2015. This module is not longer supported, check out the new version at this link. I'll fix some errors that are currently in this module for those of you who like the old version better then the newer one. Screenshot Download https://github.com/nvidoni/MarkupWeather How to installCopy module directory to /site/modules/ directory.Click check for new modules in ProcessWire Admin Modules screen. Click *install* for the module labeled: "MarkupWeather".How to useCopy this line to template of your choice where you want the weather widget to be displayed:<?php echo $modules->get('MarkupWeather')->render(); ?>This module has the following options:Yahoo! Weather WoeidWoeid is a number located right beside the city name, e.g. http://weather.yahoo.com/croatia/grad-zagreb/zagreb-851128/Set Localesets PHP locale, needed for date display localizationDate Formatdate formatted with PHP strftime functionShow 5 day forecast below current weather forecast?turn this off if you want to display compact weather widget, shows only current weatherDisplay temperature in Fahrenheit instead of Celsius?show weather conditions in Celsius or Fahrenheit scale Hope you'll like it. 14 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted July 18, 2013 Share Posted July 18, 2013 I do like it, Thank You Nikola ! Link to comment Share on other sites More sharing options...
Martijn Geerts Posted July 18, 2013 Share Posted July 18, 2013 I tried this module and it works great ! A little thing about the CSS: /* Most Frameworks render with box-sizing: border-box;, but your CSS is made for content-box */ #weather { box-sizing: content-box; } #weather * { box-sizing: content-box; } /* prevent scrolling & box collapse */ #weather .current { overflow: visible; } Link to comment Share on other sites More sharing options...
nikola Posted July 18, 2013 Author Share Posted July 18, 2013 Thanks for the follow up Martijn, I'll make the changes Link to comment Share on other sites More sharing options...
ryan Posted July 20, 2013 Share Posted July 20, 2013 Awesome Nikola! I really like this module. Just a few suggestions: The module should not extend Process since it's not an admin process. Instead it should extend WireData. The module should not be autoload since it is loaded from an API call instead. Ideally the module would be called MarkupWeather or MarkupYahooWeather, since the "Markup" prefix is recommended for all markup-generation modules. Please add it to the modules directory as soon as you get the chance. It's a lot simpler to do now, as the modules directory pulls most stuff right from your GitHub page. 2 Link to comment Share on other sites More sharing options...
nikola Posted July 22, 2013 Author Share Posted July 22, 2013 Ryan, I've made all of the changes you suggested and I've put the module in modules directory. 3 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted July 22, 2013 Share Posted July 22, 2013 That will solve the include of your styles/scripts in admin to. Thanks again for creating this module. I'm sure i will use it. Link to comment Share on other sites More sharing options...
Pete Posted November 23, 2013 Share Posted November 23, 2013 I had a need to output two sets of weather conditions. You can achieve this by simply passing the woeid before rendering the output like this: <?php $weather = $modules->get('MarkupWeather'); // Husum, Germany $weather->woeid = 24907; echo $weather->render(); // Kidderminster, England $weather->woeid = 663053; echo $weather->render(); I've got a few ideas for improving this module and might have a go at them when I get a sec: Allow for multiple locations in config Have the module install the output as a template in the site/templates folder (so future upgrades don't break any template changes) I think that's it really - other than that it's awesome Link to comment Share on other sites More sharing options...
mr-fan Posted March 25, 2015 Share Posted March 25, 2015 Hi guys, thank you nikola for this module just one thing i found to solve is the check if $result was true and the file_get_contents(); work.... for me some short times the service API was not available so the whole render() give me an error and break the whole page....not so good if you use this one as widget or on every page and so on... Did a pull request on github and here i post the german lang file.... Thank you again for this great widget! best regards mr-fan markupWeatherDE.zip 1 Link to comment Share on other sites More sharing options...
nikola Posted March 27, 2015 Author Share Posted March 27, 2015 Glad you like it mr-fan! I've merged your pull request into the module. 3 Link to comment Share on other sites More sharing options...
mr-fan Posted April 1, 2015 Share Posted April 1, 2015 I've found that for some issues the replacement of the conditions text did not work...on some strings. like i wrote in the german translations threat...there are some problem to get the strings. $out .= "<div class='conditions'>" . __("Current Conditions:", __FILE__) . " <span>" . str_replace(array_keys($conditions), $conditions, $current['text']) . "</span></div>"; so it would be saver if we don't replace the text and use the conditions code for this one...if i found some time on "ostern" may i could run a test and a PR for this. So we get the condition Code - and check if this code is not there so no condition output....so we get no weird outputs. regards mr-fan Link to comment Share on other sites More sharing options...
mr-fan Posted April 1, 2015 Share Posted April 1, 2015 So problem solved the Module gets a PR on github changed the array for the condition strings...so we can use the API code as keys and load the condition better. And have build in a if for the condition itself - so if the API code change or a new one is added we get no error on the frontend just the condition has no output anymore...so it's a little bit saver for the API code <=> condition text stuff. Please have a look and make a new merge if you accepted/tested the changes? best regards mr-fan crosslink to the new german lang file (backend translated, too) Link to comment Share on other sites More sharing options...
nikola Posted April 2, 2015 Author Share Posted April 2, 2015 Thanks, mr-fan, I had a look on your pull request and it looks fine. I'll merge it these days I'm planning to update a module a little bit these days, I have to change the icons to newer ones (maybe weather icon font...) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now