Query("select biere_id from b_comm"); while ($b->NextRow()) $biere_id_array[] = $b->Get("biere_id"); srand((double)microtime()*1000000); $biere_id = $biere_id_array[rand(0,count($biere_id_array)-1)]; } // detail sur la biere $b = new RecordSet($hostname,$username,$password,$dbname); $b->Query("select * from bieres as a, couleur as b , type as c where a.id = '$biere_id' and b.id=a.couleur_id and c.id=a.type_id"); $xtpl->assign("COULEUR",ucfirst($b->Get("b.nom"))); $xtpl->assign("TYPE",ucfirst($b->Get("c.nom"))); $xtpl->assign("NOM",ucfirst($b->Get("nom"))); $xtpl->assign("BIERE_ID",$b->Get("id")); if ($b->Get("alcool")>0) { $xtpl->assign("ALCOOL",$b->Get("alcool")); $xtpl->parse("main.alco"); } if ( strcmp($b->Get('etiquette'),"") != 0) { $xtpl->assign("ETIQUETTES",strtolower($b->Get('etiquette'))); $xtpl->parse("main.etiqu"); $img++; } $ba = new RecordSet($hostname,$username,$password,$dbname); if (strcmp(trim($b->Get('brasserie_id')),"") != 0) { $query = "select * from brasseries where id = '" . $b->Get('brasserie_id') . "'"; $ba->Query($query); $xtpl->assign("BRASSERIE",ucfirst($ba->Get("nom"))); $xtpl->assign("BRASSERIE_ID",$ba->Get("id")); $xtpl->assign("ADRESSE",ucfirst($ba->Get("adresse"))); $xtpl->assign("CP",$ba->Get("cp")); $xtpl->assign("TEL",$ba->Get("tel")); $xtpl->assign("LOCALITE",ucfirst($ba->Get("localite"))); $xtpl->parse("main.Brass"); } $sous = new RecordSet($hostname,$username,$password,$dbname); $sous->Query("select * from sous_bock where biere_id = '$biere_id'"); if ($sous->NextRow()) { do { $xtpl->assign("SOUS_BOCK",$sous->Get("image")); $xtpl->parse("main.sous.li"); } while ($sous->NextRow()); $img++; $xtpl->parse("main.sous"); } if ($img == 0) $xtpl->parse("main.no_sous"); // Liste des comm dsur une biere $b = new RecordSet($hostname,$username,$password,$dbname); $b->Query("select * from b_comm where biere_id = '$biere_id' order by date desc limit 0,2"); if ($b->NextRow()) { do { $comm = ereg_replace ("~","?",$b->Get("comm")); $subject = ereg_replace ("~","?",$b->Get("subject")); $xtpl->assign("SUBJECT",ucfirst($subject)); $xtpl->assign("NAME",ucfirst($b->Get("name"))); $xtpl->assign("EMAIL",$b->Get("email")); $xtpl->assign("COMM",ucfirst($comm)); $xtpl->parse("main.comm_list.li"); } while ($b->NextRow()); $xtpl->parse("main.comm_list"); } // get the news $article = new RecordSet($hostname,$username,$password,$dbname); $article->Query("select * from news_art order by art_pubdate desc limit 0,1"); while ($article->NextRow()) { $xtpl->assign("ART_TITLE",MyDb2Html($article->Get("art_title"))); $xtpl->assign("ART_SUBTITLE",MyDb2Html($article->Get("art_subtitle"))); $xtpl->assign("ART_BODY",MyDb2Html($article->Get("art_body"))); $xtpl->assign("ART_PUBDATE",$article->Get("art_pubdate")); $xtpl->assign("ART_AUTHOR",$article->Get("art_author")); if (strlen($article->Get("art_url"))!=0) { $xtpl->assign("ART_URL",$article->Get("art_url")); $xtpl->parse("main.news.url"); } } //$xtpl->parse("main.news"); $xtpl->parse("main.Titre"); include "left.inc.php"; include "right.inc.php"; include "banner.inc.php"; $xtpl->parse("main"); $xtpl->out("main"); ?>