Page 1 of 1
if (empty()); Question
Posted: Sat Dec 03, 2005 8:31 pm
by $var
I am trying to write a script that changes an image based on a date value in the field.
If there is no image associated with a date, I would just like to display the next image available.
Is there something that would go in here that would tell it to go to the next field if the image isn't there?
thanks
Posted: Sat Dec 03, 2005 8:38 pm
by seodevhead
Well... let's say you determine which day it is by using:
Code: Select all
$current_day = date('l'); // Lowercase L
# above would set $current_day = Monday for example
If you have images called:
Monday.jpg
Tuesday.jpg
Wednesday.jpg
etc.
Then this is what you are looking for.
Code: Select all
$counter = 1;
if(empty($image))
{
$current_day = date('l')+$counter;
$counter++;
}
Of course the if statement should be in a loop.
If I am wrong, please correct me and my apologies.
Posted: Sat Dec 03, 2005 8:44 pm
by $var
i don't know if this would be suitable... as i think that the images will be uploaded with indefinate naming for inconsitent dates.
is there something like
if (empty()) {
disp_next_row
}
i know this isn't the case though, i check the manual.
Posted: Sat Dec 03, 2005 8:49 pm
by John Cartwright
depends on your setup, post the code.
Posted: Sat Dec 03, 2005 8:51 pm
by seodevhead
If this is the case, then you need to provide us with some more of your code to understand what you want precisely. How is the images table set up? What determines what image is pulled depending on the date? Get back to us and we'll help you best we can!.
