Skip to content

Instantly share code, notes, and snippets.

@akakiev
Created June 28, 2017 16:15
Show Gist options
  • Save akakiev/1cca0f2bbdcb7b4c3e4ecdcee1e242ac to your computer and use it in GitHub Desktop.
Save akakiev/1cca0f2bbdcb7b4c3e4ecdcee1e242ac to your computer and use it in GitHub Desktop.
The_best_automobiles_horizontal
body{
background:#111111;
color:white;}
#center{
width:100%;
margin-top:-20px;}
td{
padding:20px;}
#logo_text{
height:10px;
width:25%;
font:24px impact;
letter-spacing:3px;}
#menu{
min-width:150px;}
#menu a{
font:bold 20px tahoma;
display:block;
text-decoration:none;
color:#909090;}
#menu a:hover{
color:#ffffff;
}
#menu a.action{
color:#ffffff;
}
.foto_car img{
width:100%;
}
<!DOCTYPE html>
<html>
<head>
<title>Кращі автомобілі</title>
<link rel="stylesheet" type="text/css" href="t14z2.css">
</head>
<body>
<?
include "start1.php";
$am=get_action_menu();
$menu=get_menu();
$foto=get_foto($am);
?>
<table id='center' cellspacing="0" border="0" bordercolor="#fff" >
<tr id='top'>
<td id='logo_text' valign='top'>
КРАЩІ АВТОМОБІЛІ СВІТУ
</td>
<td id='content' rowspan='2'>
<? print_foto($foto); ?>
</td>
</tr>
<tr>
<td id='menu' valign="top">
<? print_menu($menu,$am); ?>
</td>
</tr>
</table>
</body>
<?
function get_action_menu(){
if(isset($_GET['menu'])){
$am=$_GET['menu'];
}else{
$am=1;
}
return $am;
}
function get_menu(){
$tab=mysql_query("SELECT * FROM car ");
$i=1;
while($row=mysql_fetch_array($tab)){
$menu[$i]['id']=$row['id'];
$menu[$i]['name']=$row['name'];
$i++;
}
return $menu;
}
function get_foto($am){
$tab=mysql_query("SELECT foto FROM foto WHERE id_car='$am'");
$i=1;
while($row=mysql_fetch_array($tab)){
$foto[$i]=$row['foto'];
$i++;
}
return $foto;
}
function print_menu($m,$am){
for($i=1;$i<=count($m);$i++){
$cl="";
if($i==$am){
$cl="class='action'";
}
echo "<a href='?menu=".$m[$i]['id']."'".$cl.">".$m[$i]['name']."</a><br>";
}
}
function print_foto($f){
for($i=1;$i<=count($f);$i++){
echo"<div class='foto_car'>";
echo "<img src='".$f[$i]."'>";
echo"</div>";
}
}
?>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment