logo change by time of day

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    logo change by time of day

    PHP Code:
    ////////////////////////////////in core
    function logo($fus)
    {
      
    $lo time() + ($fus 60 60);
      
    $ora =date("G"$xp);

    if (
    $ora <= 4) {
    $logo="<img src=\"logo/nbuna.png\" alt=\"x\"/>" ;
    }else if (
    $ora <= 10) { 
    $logo="<img src=\"logo/neatza.png\" alt=\"x\"/>" 
    }else if (
    $ora <= 16) {
    $logo="<img src=\"logo/ziua.png\" alt=\"x\"/>" 
    }else if (
    $ora <= 22) { 
    $logo="<img src=\"logo/seara.png\" alt=\"x\"/>" ;
    }

       return 
    $logo;

    PHP Code:
    ///////in index
    echo "".logo("0")."<br/>";
    Create 4 logos depending on time of day 
    Last edited by valentinbr; 23.05.09, 08:24.

    #2
    Updated
    ///////bcoz that was the beta
    PHP Code:
    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
    Attached Files
    <?php unlink('World/Europe/Romania.country'); ?>

    Comment


      #3
      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

      Comment


        #4
        Originally posted by djlee View Post
        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'); ?>

        Comment


          #5
          Thanks buddy.

          Comment


            #6
            thanks mate

            Comment


              #7
              Is not very hard to code a script like that. Is it? ... 10 minutes of hard work :D...
              Anyway ... Nice share.
              whatmp3.name - search mp3 on mobile

              Comment


                #8
                Thanks bro..!

                Comment

                Working...
                X