1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
<?
include("header.inc.php");
$id_resto=$_GET["id"];
$query_exists = mysql_query("SELECT COUNT(id) FROM resto WHERE id='$id_resto'");
$result_exists = mysql_fetch_row($query_exists);
if ($result_exists[0]==0)
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: index.php");
die("Redirection");
}
else
{
// champs à sélectionner / à afficher
$tab_champs = array("id","title","city","note","description","address","phone","website","cap","menu_entree","menu_plat","menu_dessert","youtube_link","resa","horferm","pain","prix","serviette","latable","sympaekip","aime","aimemoins","ofinal" );
$chr_champs='';
foreach($tab_champs as $val) $chr_champs.=$val.', ';
$chr_champs=substr($chr_champs,0,-2);
$q = mysql_query("SELECT $chr_champs FROM resto WHERE id='$id_resto'");
$r = mysql_fetch_assoc($q);
$quser = mysql_query("SELECT id_user FROM users_restos WHERE id_resto='$r[id]'" ) or die(mysql_error());
$ruser = mysql_fetch_assoc($quser);
}
/////////////////////////////
////////////////////////////////
//////////////////////
<?
$tab_photos=array();
for($i=1;$i<=8;$i++)
{
$path_img = 'photos/'.$r["id"].'_'.$i.'.jpg';
$path_img2 = 'photos/'.$r["id"].'_'.$i.'_125.jpg';
if(file_exists($path_img)) { $tab_photos[]=array($i,$id_resto,$path_img,$path_img2); }
}
if (@count($tab_photos)>0)
{
?>
<script type="text/javascript">
$(document).ready(function()
{
$("a.group").fancybox();
});
</script><br>
<div id="photos">
<?
$cpt=1;
foreach($tab_photos as $val)
{
?>
<p style="float:left; width:130px; margin-bottom:10px; <? if ($cpt%2!=0) { echo 'margin-right:10px;'; } ?>"><a class="group" rel="group" title="Photo <?=$cpt;?>" href="<?=$val[2];?>"><img src="<?=$val[3];?>" alt="Photo <?=$cpt;?>" /></a></p>
<?
$cpt++;
}
?> |