Code : Tout sélectionner
</head>
<body>
<div id="carte">
<div id="stdenis" class="Style44" style="display:;">
<a href="http://meteo-saintdenis01.perso.sfr.fr/" target="_blank" class="tooltip">
<img src="Icon.gif" border="1" align="middle"><div id="stdenis2" style="background-color:#FFFFFF" align="center"><font style=size="4px" align="center">
<?php $num_ligne=1;
$fichier='http://meteo-saintdenis01.perso.sfr.fr/data2.txt';
$time='';
$fp=fopen($fichier,'r');
$i=0;
while (!feof($fp)) {
$i++;
$position=explode("*",fgets($fp,255));
if($i==$num_ligne) $time=$position[2]; //on m駑orise le temps de la ligne voulue
}
fclose($fp);
print "".$time."°C";
?></font><span>
</a>
</div></div>
</body>
</html>
<?php
require_once "colorlib.php";
$blanc = "255,255,255";
$bleu = "9,66,134";
$legende = getMidColors($blanc,$bleu,15);
?>
<div id="stdenis2" style="background-color:<?php
echo $legende[$la_variable_qui_permet_le_choix];
?>
" align="center">
etc. etc.
Code : Tout sélectionner
<?php $num_ligne=1;
$fichier='http://meteo-saintdenis01.perso.sfr.fr/data2.txt';
$time='';
$fp=fopen($fichier,'r');
$i=0;
while (!feof($fp)) {
$i++;
$position=explode("*",fgets($fp,255));
if($i==$num_ligne) $time=$position[2]; //on m駑orise le temps de la ligne voulue
}
fclose($fp);
print "".$time."°C";
?>
<style>
*.glacial
{
background-color: black;
color: white;
font-weight:bold
}
*.frigide
{
background-color: silver;
color: white;
font-weight:bold
}
</style>
<?PHP
$styles = array(
-1 => "glacial",
0 => "frigide",
);
$temp = 2;
$dizaine = intval( $temp / 10);
if ($temp <0)
{
$style =$styles[-1];
}
else
{
$style = $styles[$dizaine];
}
$temperature = "<span class = '$style'>$temp</span>";
print "il fait $temperature";
?>