MODx Snippet, CSS and Yahoo Weather Feed
I recently created a MODx snippet using a technique described on CSS-Tricks. This little bit of PHP code calls in the Yahoo Weather RSS feed and allows you to generate output that can be styled using CSS and your own icons. You can modify the first line of the snippet below to output weather specific to your zip code.
I first created the snippet ‘Weather’ ( Here is the snippet code.), then simply placed the snippet call on the appropriate page: [!Weather?!]. I then used my CSS document to style the output and created containers that would display the appropriate class ( Here is my CSS document). I created a div tag that carried my icon as a background image. I figured if Yahoo generated a tag that was unaccounted for in my CSS then my scheme would continue to display the appropriate text while leaving the adjacent background image undisplayed (as opposed to the little red Xs if I had used an image tag). Since I am using transparent gifs, I figured no one would be the wiser should this occur. Gif’s were derived from Nordic Weather.
You can see it in action on the Batesville, Arkansas Area Chamber of Commerce website.
Tags: MODx, snippet, weather feed, weather rss, yahoo



































