function agenda_gen($type,$nbblock="12"){
global $conn;
if($type){$extsql ="and id_catets =\"$type\"";}
$sql_listeve = "
SELECT DAYOFMONTH(start)
AS
jour, start, event,place,date.valid,title,description,eventtype.type,image,name, town, zipcode, phone, address
FROM
place, date, events, eventtype
WHERE
start >= NOW()
AND
start < (NOW() + INTERVAL 24 DAY)
AND
eventtype.id=events.type
AND
date.place=place.id
AND
date.event=events.id
ORDER BY
start, jour, type, name
";
$result_listeve = mysql_query($sql_listeve, $conn);
$NBEVE = mysql_num_rows($result_listeve);
$tour=1;
while(list($jour, $start, $event,$place,$valid,$title,$description,$type,$image_ev,$name, $town, $zipcode, $phone, $address) = mysql_fetch_row($result_listeve))
{
$tabjour = split(" ", $start);
$tjour = $tabjour[0];
$jour = eregi_replace("-","",$tjour);
if($jour != $cejour)
{
if($tour !=1){
$agenda .="
</dl>";
}
$agenda .="
<h3>
".date_zoli($start)."
</h3>
<dl>
<dt>$type</dt>
";
$tour2++;
}else{
if($type!="$cetype")
{
if($tour !=1){$agenda .="</dl>";}
$agenda .="
<dl>
<dt>$type</dt>
";
}
}
$agenda .="
<dd class=\"nomsoiree\">".stripslashes("$title")."</dd>
<dd class=\"lieu\"><span>".DATETIMEFR($start,3)."</span> $name</dd>
<dd class=\"description\">".stripslashes("$description")."</dd>
";
$tour++;
$cejour="$jour";
$cetype="$type";
if($tour2 == $nbblock){break;}
}
$agenda .="
</dl>
";
return $agenda;
}
?>