Hi there,
Firstly, Just found this resource. It looks great Hello all.
I have a very basic events script that works with flat text files. It works like this.
I create a text file named as the date of the event. For example an event that is on 5th August 2004 will be named 20040805.txt. My upload script strips away the .txt.
Now the event will show until the date passes and then the event is hidden.
Now I need a variation of my display script so it only shows 1 event and that event has to be the event closest to todays event. I want to use it on the frontpage so I can display 'Our newxt event will be on ‘blah, blah, blah’.
I have this code and although it shows just the one date it shows the most recentely uploaded as against my need of the event closest to todays date.
<?php
$date = date("Ymd", time()+3600*7);
$NumEvents = 0;
$handle = opendir('../event_dates');
$i=1;
while (($file = readdir($handle)) !== false) {
if($i==1)
{
$hfile = $file;
$i++;
}
else if ($hfile<=$file) {
$hfile = $file;
}
}
if($i!=1)
include '../event_dates/' . $hfile;
else {
echo "<strong class='red'>Sorry, no events are planned at present</strong>";
}
?>
Does anyone know how to tweak my script to allow what I need it to do?
Hope you can help.
Many thanks
Karl