Contact me
This form does not yet contain any fields.
    Blog Index
    The journal that this archive was targeting has been deleted. Please update your configuration.
    Navigation

    About ForEEcast

    $10 at Devot-ee


    Need Help?

    Contact me using the form on the right or on twitter.


    ForEEcast pulls it's data from Weather.gov and provides a five day weather forecast for your ExpressionEngine web project based on a target zip code.

    ForEEcast sample

    A note about caching

    The Weather.gov data service can be slow and unresponsive. To make sure your site is as fast as possible, this plugin makes extensive usage of results caching. Make sure your ExpressionEngine cache folder is writable. By default ExpressionEngine stores cache here:

    • /system/expressionengine/cache

    If Foreecast cannot write results to the file system, it will have to download data every time the page is loaded.

    Usage

    Basic forecast output:

    {exp:foreecast zipcode="90210"}
        Date Name: {date_name}
        Timestamp: {timestamp}
        Icon URL : {icon}
        Temperature: {temperature}
        Precipitation: {precipitation}
        Conditions: {conditions}
        Conditions Shortname: {conditions_shortname}
        Description: {description}
    {/exp:foreecast}

    Output results

    Unless results are contrained (see parameters below), you will get back six results.

    About the result set itself

    Weather.gov and other weather services publish data based on the current time, and the relative output changes depending on the time of day. You will see a couple of formats to the data, such as these examples:

    • Today, Tonight, Tomorrow, Tomorrow + 1, Tomorrow + 2, Tomorrow + 3
    • Tonight, Tomorrow, Tomorrow Night, Tomorrow + 1, Tomorrow + 2, Tomorrow + 3

    Available Tags

    • {date_name} : The friendly name for the result, for example: Today, Tonight, Wednesday, Friday.
    • {timestamp} : The timestamp that the record applies to.
    • {icon} : The URL for the icon offered by Weather.gov for the conditions during this period.
    • {temperature} : The forecasted tempurature (in Fahrenheit). Results that are full day results are displayed as High | Low tempuratures.
      • This is wrapped in tags to allow some control over the presentation of High and Low values. For example:
    <span class='high_temperature'>63</span> | <span class='low_temperature'>50</span>
    • {precipitation} : The likelyhood that there will be preciption during this period, expressed as a percentage. For example: 70%.
    • {conditions} : A short summary of the expected conditions. For example: High Winds.
    • {conditionsshortname} : A shortname style version of the {conditions}. For example: *highwinds*.
      • This would be useful for providing alternative icons.
    • {description} : A written descritpion of the expected weather for this period. For example:
      • Mostly cloudy, with a low around 47. North wind around 5 mph becoming calm.

    {exp:foreecast} has four parameters:

    • zipcode : [default: 90210] The US zipcode that you want the forecast for.
    • offset : [default: 0] The offset allows you to skip one or more results.
    • limit : [default: 6] The limit allows you to restrict the number of results.
    • cache_refresh : [default: 180] Allows you to tweak how long results are cached (set to 0 to disable cache).

    For example, if you want to only show the very first forecast result:

    {exp:foreecast zipcode="90210" limit="1"}
        Date Name: {date_name}
    {/exp:foreecast}

    If you want to only show the very last forecast result:

    {exp:foreecast zipcode="90210" offset="5" limit="1"}
        Date Name: {date_name}
    {/exp:foreecast}

    If you want to show the next two forecast results:

    {exp:foreecast zipcode="90210" limit="2"}
        Date Name: {date_name}
    {/exp:foreecast}