Results 1 to 2 of 2

Thread: help on countdown ticker

  1. #1
    Join Date
    Jan 2007
    Location
    Ireland
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help on countdown ticker

    I touched PHP yesterday for the first time
    God, do i love it

    But I have a question.

    I am making a countdown ticker/banner till a certain venue:

    I set a startdate
    I set a targetdate
    I read the current date
    I calculate the days that passed since the date of the venue is known
    and assign that to $offset
    [$offset = (int) ($currentdate - startdate/constant) ]

    I break out, to define an image and its position by

    <table width=500px>
    <tr>
    <td>
    <img src="plaatje.jpg" style="position:relative; left:<?php echo: $offset ?>px">
    </td>
    </tr>
    </table>



    So the picture moves to the right.
    <in fairness I multiply $offset to have the image move 2 or 3 pixels a day>

    I want o avoid however, that my image exceeds moving to the right after the venuedate., and at the moment it does

    Any suggestions anyone



    Kind Regards
    Bas
    http://www.de-ridder.info

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Try making a condition like this:

    Code:
      if ($currentdate == $targetdate) {
          $offset = "40"; //offset for desired position
      }
    
      else {
          $offset = math(); //you math here
      }
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

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