Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Weather Data to Change my Website’s Appearance

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #26807
    steffen81
    Member

    Hello, i am new on this forum – but i am a big fan of Css-tricks.com.
    Posting because i am a bit stuck on the php..

    On my “blog” Storesteinen.com i use the script found on this page:
    CSS-Tricks. It works great, and the picture of my house changes as the weather changes.

    Problem is:

    The code is supposted to handle night/day. (As in examples):

    26 cloudy
    27 mostly cloudy (night)
    28 mostly cloudy (day)
    29 partly cloudy (night)

    Cloudy is no problem. And mostly-cloudy is ok, as in my working code:

    .header-cloudy, .header-mostly-cloudy{
    background: url(images/overskyet.gif) no-repeat center center black;
    }

    But how can i make the (night) (day) to work?
    ( I want to make one picture for night and one day)

    I try this;

    .header-mostly-cloudy-night{
    background: url(images/overskyadag.gif) no-repeat center center black;
    }

    And it is not working.

    Sorry if this is a difficult question. Guess someone have to have tested the script to know what i am talking about.

    – Steffen

    #76057
    cybershot
    Participant

    well, if I had to guess, it is not because of your css, it would be because of the javascript. the javascript has a debug line of code in it to see what you get back from the weather, you need to check the debug code to make sure there is a mostly-cloudy-night

    #76061
    steffen81
    Member

    Yes you are right. It probably do not handle mostly-cloudy-night. All i know is that the text on this page says it should handle 47 different text, where of nr 26-29 is this:

    26 cloudy
    27 mostly cloudy (night)
    28 mostly cloudy (day)
    29 partly cloudy (night)

    There are also
    33 fair (night)
    34 fair (day)

    Every other code i understand and can use, but i dont find any place that explains me how to wright the code that has (night) og (day).

    #76150
    steffen81
    Member

    The code in the php script is this:

    $weather_class = format_result(get_match(‘/ yweather:condition text=”(.*)”/isU’,$data));

    That is getting the data from the yahoo weather Rss code like this:

    yweather:condition text=”Mostly Cloudy” code=”27″ temp=”37″ date=”Sun, 14 Nov 2010 9:20 pm CET” /

    Code 27 is : 27 mostly cloudy (night)

    But the $weather_class is only getting “text” mostly cloudy not “code”… I think i have to get the code to be able to change between

    27 mostly cloudy (night)
    28 mostly cloudy (day)

    I am trying different things, but cant make it work.

    Was trying

    $weather_class = format_result(get_match(‘/ yweather:condition code=”(.*)”/isU’,$data));

    Getting code instead of text, but it did not work.

    Anyone have an idea.?

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.