Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    Regular Coder
    Join Date
    Nov 2010
    Posts
    204
    Thanks
    10
    Thanked 0 Times in 0 Posts

    [Paid (Negotiable)] Turning a countdown in to a live ticker...

    ** Note of interest as to not get anyone here in a hissy... It was suggested that I put this post here, so this is not a double post compared to my post in the JS board. **

    1) Project Details: Check out turtle-tv.com

    Notice the (Lights on/off ...) stuff above the chat and ustream windows. I would like to have it turned in to a live ticker that updates without needing to refrsh the page. It currently runs off of server time which is how I'd like it to stay.

    So lets say the current time was 7:29:59am

    The message in the parenthesis would read (Lights on in 1 Sec)

    Then come 7:30am the message would read...

    (Lights off in 12 Hrs, 30 Mins)

    Ok, so you should now get the idea of how it works so I don't need an example of what it would read come 7:59:59pm etc etc etc.

    2) Payment Amount: Negotiable

    3) Payment Method: PayPal

    4) Timeline: Done when it's done (no rush)

    5) Additional Info:

    The first block of code is what produces everything you see at turtle-tv.com...

    The second block is something OldPedant hooked me up with a while back for a different project and is what I would like to have worked in since it's good, usable code. Obviously certain things will need to be removed / omitted since it doesnt apply to this project like the $contestend stuff and the bit that would display when the counter reaches 0.

    Block 1
    Code:
    <?php
    $lights_on = '7:30am';
    $lights_off = '8pm';
    $time = lights_on_off(time(), $lights_on, $lights_off);
    ?>
    
    <head>
    <title>Niko's Live 24/7 Video Broadcast</title>
    </head>
    
    <body background="./smalls_file_mainBg_1919366_7636654_l.jpg">
    <font size="2" color="FFFF00" style="background: #181818;">Time Now: <?php echo date('g:ia'); ?></font>
    
    <center>
    <font size="5" color="FFFF00" style="background: #181818;">
    Lights out from <?php echo $lights_off; ?> to <?php echo $lights_on; ?> <?php echo date('T'); ?> 
    (Lights <?php echo $time['n_state']; ?> in 
    <?php
    $h = ($time['remaining']['m'] + 1 ==60) ? $time['remaining']['h'] + 1 : $time['remaining']['h'];
    $m = ($time['remaining']['m'] + 1 ==60) ? 0 : $time['remaining']['m'];
    $s = ($time['remaining']['m'] + 1 ==60) ? 0 : $time['remaining']['s'];
    echo ($h>1) ? $h . ' Hrs, ' : (($h==1) ? $h . ' Hr, ' : ' ');
    echo ($m>1) ? $m . ' Mins & ' : (($m==1) ? $m . ' Min & ' : ' ');
    echo ($s>1) ? $s . ' Secs' : (($s==1) ? $s . ' Sec' : '0 Secs');
    ?>
    ) !
    </font></center>
    
    <?php
    
    function lights_on_off($time, $lights_on, $lights_off){
      $time = (isset($time)) ? $time :  time();
    
      $d_lights_on = strtotime($lights_on);
      $d_lights_off = strtotime($lights_off);
    
      $secs_lights_on = (date("G",$d_lights_on)*60 + date("i",$d_lights_on))*60 + date("s",$d_lights_on);
      $secs_lights_off = (date("G",$d_lights_off)*60 + date("i",$d_lights_off))*60 + date("s",$d_lights_off);
    
      $secs = (date("G",$time)*60 + date("i",$time))*60 + date("s",$time);
    
      $c_state = ($secs_lights_on < $secs && $secs < $secs_lights_off) ? 'on' : 'off';
      $n_state = ($secs_lights_on < $secs && $secs < $secs_lights_off) ? 'off' : 'on';
    
      $next_switch = ($secs_lights_on < $secs && $secs_lights_off > $secs) ? $secs_lights_off : ($secs_lights_on + 60*60*24);
      $next_switch = ($next_switch > ($secs+60*60*24)) ? $next_switch - (60*60*24) : $next_switch;
      $time_rem = $next_switch - $secs;
    
      $h = floor($time_rem/(60*60));
      $m = floor(($time_rem-($h*60*60))/60);
      $s = $time_rem-($h*60*60)-($m*60);
    
      return array('c_state' => $c_state,'n_state' => $n_state, 'remaining' => array('secs' => $next_switch, 'h' => $h, 'm' => $m, 's' => $s));
    }
    
    ?>
    
    <center>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="600" height="523" id="utv451302">
    <param name="flashvars" value="autoplay=false&amp;brand=embed&amp;cid=1919366"/><param name="allowfullscreen" value="true"/>
    <param name="allowscriptaccess" value="always"/><param name="movie" value="http://www.ustream.tv/flash/live/1/1919366"/>
    <embed flashvars="autoplay=false&amp;brand=embed&amp;cid=1919366" width="625" height="545" allowfullscreen="true" allowscriptaccess="always" 
    id="utv451302" name="utv_n_740840" src="http://www.ustream.tv/flash/live/1/1919366" type="application/x-shockwave-flash" /></object>
    &nbsp;
    <iframe scrolling="no" height="523" frameborder="0" width="576" src="./prochatrooms/index.php"></iframe>
    </center>
    </body>
    Block 2a
    Code:
    <script type="text/javascript">
    var curTime = <?php time() ?>; 
    var endTime = <?php $contestend ?>;
    var tock = null;
    
    function tick( )
    {
        var msg = "";
        var secs = endTime - curTime;
        ++curTime;
    
        if ( secs <= 0 )
        {
            clearInterval(tock);
            document.getElementById("remain").innerHTML = "------- Sorry, but this contest ended on <?php echo date('D. F jS, Y', strftime($contestend)); ?> -------";
            return;
        }
    
        var show = false;
        var days = Math.floor( secs / 86400 ); // 86400 seconds in a day
        if ( days > 0 ) show = true;
        if ( show ) msg += days + ( days != 1 ? " Days, " : " Day, " );
    
        secs %= 86400;
        var hrs = Math.floor( secs/ 3600 );
        if ( hrs > 0 ) show = true;
        if ( show ) msg += hrs + ( hrs != 1 ? " Hrs, " : " Hr, " );
    
        secs %= 3600;
        var mins = Math.floor( secs / 60 );
        if ( mins > 0 ) show = true;
        if ( show ) msg += mins + ( mins != 1 ? " Mins & " : " Min & " );
    
        secs %= 60;
        msg += secs + ( secs != 1 ? " Secs " : " Sec " );
    
        var t = document.getElementById("ticker");
        t.innerHTML = msg;
        if ( ! show ) t.style.color = "red";
    }
    </script>
    Block 2b (Not really needed since it's the display aspect but posting for the sake of completeness...)
    Code:
    <span id="ticker">Loading...</span>
    Ps: One other thing that would obviously need to be omitted is the red text upon the final second being passed... since this will be a continual clock with roll over between lights on and off.

    I'm guessing thats easily enough solved just by removing the below line of code...
    Code:
    if ( ! show ) t.style.color = "red";

  • #2
    Regular Coder
    Join Date
    Nov 2010
    Posts
    204
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Job more or less accepted by ThePHPSolution, just working out the particulars.

    Will update upon job completion or help still needed...

  • #3
    Regular Coder
    Join Date
    Nov 2010
    Posts
    204
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Been paid ($20) for since Feb, no communication since 3/19 via this site and email.

    Not feeling to good about this right now... I just emailed John saying the following... not sure if anything will come of it.

    John, I really would like to try and finish this so when you can can you please message me so we can figure out those quirks I mentioned. If not then can you please refund my money, I don't mind being patient but not when there's no communication going on.

    Ty !
    Anyway, if someone wants to try and toss me a favor here and get this work done so I'm not at a total loss I'd appreciate it.

    Thx...

  • #4
    Regular Coder
    Join Date
    Nov 2010
    Posts
    204
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Still no word via email or this site from ThePHPSolution, really feeling like I got ripped off now since this project has been paid for and past the PayPal dispute point.

  • #5
    Regular Coder kokjj87's Avatar
    Join Date
    Sep 2008
    Location
    Singapore
    Posts
    279
    Thanks
    1
    Thanked 55 Times in 54 Posts
    You actually trust him when he only got 1 post in this forum?

  • #6
    Regular Coder
    Join Date
    Nov 2010
    Posts
    204
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by kokjj87 View Post
    You actually trust him when he only got 1 post in this forum?
    You actually felt the need to make that reply ?

  • #7
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Well it does serve as a common sense check. Blunt, perhaps, but a valid point to clarify.

    Anyway, I'd help you out but your page doesn't seem to use (or even contain) any of the javascript you have pasted in your initial message. Also, your "time now" block doesn't have an id, nor does your "lights out" message bar. These would be very basic steps to take to make this script easier to build/debug.

    And, beyond that, you should add a doctype and fix your HTML structure so that your page validates.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #8
    Regular Coder
    Join Date
    Nov 2010
    Posts
    204
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Rowsdower! View Post
    Well it does serve as a common sense check. Blunt, perhaps, but a valid point to clarify.

    Anyway, I'd help you out but your page doesn't seem to use (or even contain) any of the javascript you have pasted in your initial message. Also, your "time now" block doesn't have an id, nor does your "lights out" message bar. These would be very basic steps to take to make this script easier to build/debug.

    And, beyond that, you should add a doctype and fix your HTML structure so that your page validates.
    The JS is explained, as a different project the code was provided for NOT this one. Everything that seems is missing is infact not, so the only thing to really address would be validation which is not a big deal for me given that this isnt a production / professional site nor is it meant to me.

    It's just there to serve a simple purpose.

  • #9
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Can beggars be choosers, after all? I've always heard differently.

    Look... Adding id attributes where I suggested you add them (and yes, they are missing) will make writing the javascript an easy job. Fixing the markup for validation is just good practice, and the DOM likes it, and - in cases where other people have to work around your mess - it's just polite to tidy up. Adding javascript to the head of the HTML document - even if it's not 100% correct code - will make tinkering with your page locally much easier when using Firebug. So all of the suggested changes make scripting the page easier.

    You need to understand that for free help you need to make things as easy as possible. By even making me explain this to you, you have already made this harder than I care to deal with any further.

    You'll be in a better position to get someone else to help you though, if you do what I suggested.

    Either way, best of luck to you!
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #10
    New to the CF scene
    Join Date
    Jun 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Did you find a programmer?

  • #11
    Regular Coder
    Join Date
    Nov 2010
    Posts
    204
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by routerboy View Post
    Did you find a programmer?
    Ya, just waiting on some things to be finalized but keep a sub goin on this post just in case, Ty.

  • #12
    Regular Coder
    Join Date
    Nov 2010
    Posts
    204
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by beeanin View Post
    You actually trust him when he only got 1 post in this forum?




    http://www.sneakersshoponline.com
    As I told a few other people, he eactually completed the work except for fixing some bugs and before I could get the file he went MIA.

    So I guess I'm 50/50 on him.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •