CSS PHP katıştırma

0 Cevap php

Ben görüntü değişiklikleri günün saatine göre değişken bir arka plan oluşturmak için çalışıyorum. Ben çalışmak için kullanılan, ama ben bir yerde hat boyunca bir şey yaptım ve bu kod işlevsellik kırık olduğunu fark etmedi. Bu işe yaramazsa neden Birisi bana açıklayabilir misiniz?

<html>
<?php

    function day()
    {
        if ( $hour >= 6 && $hour <= 18 )
        {
        return 1;
        } else { return 0; }
    }

?>

<style type="text/css">

body
{

    background-image: url('<?php echo (day() ? 'images/day_sheep.jpg'
                                             : 'images/night_sheep.jpg'); ?>');
    background-position: 50% 50%;
    background-repeat: no-repeat;
    background-color: silver
}

a {text-decoration:none;}
a:link {color:#ff0000;}
a:visited {color:#0000FF;}
a:hover {text-decoration:underline;}

</style>

</html>

0 Cevap