I0
Updated
///////bcoz that was the beta
function xplogo($fus)
{
$xp = time() + ($fus * 60 * 60);
$ora =date("G", $xp);
if ($ora <= 6) {
$logo="<img src=\"logo/nbuna.png\" alt=\"x\"/>" ;
}else if ($ora <= 10) {
$logo="<img src=\"logo/neatza.png\" alt=\"x\"/>" ;
}else if ($ora <= 18) {
$logo="<img src=\"logo/ziua.png\" alt=\"x\"/>" ;
}else if ($ora <= 22) {
$logo="<img src=\"logo/seara.png\" alt=\"x\"/>" ;
}
return $logo;
}
and who want logo like that pm me:)
<?php unlink('World/Europe/Romania.country'); ?>
I0
djlee wrote:
simple but effective, just a bit of info though, when your working with stuff like this where your returning only a line or twoits a lot nicer to use the switch() statment than a big tree of IF's... switch does have a slight better performance in this scenario but nothing worth measuring, its simply for code readability and good design... plus its the perfect opportunity for people to learn how switches work if they arent familiar with um 🙂
on the whole though its a nice little addon, just a note to anyone looking for something slightly different
if you want just morning and afternoon, just use the am/pm date param and name your logos am.png/pm.png and theres no need for the if's or a switch or if you have one per hour you could name them 1.png/2.png/3.png ect and call them directly without the conditional tree
just mentioning it as i saw two people recently that used both those things and used a conditional tree for which its not needed :)
thx for the info mane:D
<?php unlink('World/Europe/Romania.country'); ?>