Log in

View Full Version : help on countdown ticker



desiredbard
01-19-2007, 09:05 AM
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

thetestingsite
01-20-2007, 01:46 AM
Try making a condition like this:



if ($currentdate == $targetdate) {
$offset = "40"; //offset for desired position
}

else {
$offset = math(); //you math here
}


Hope this helps.