[Resolvido] Galeria em categorias
Olá gente. Fiz uma galeria com banco de dados em mysql, fiz utilização do lightbox... e tenho um gerenciador..
a parte do gerenciador ja está feita..
as tabelas do banco da galeria(no caso aqui seria a categoria) são estas:
gal_id gal_title gal_img h_i_d_e
e as tabelas do banco das fotos são estas:
fot_id fot_title fot_img gal_id fot_desc h_i_d_e
a inserção pelo gerenciador está funcionando normal .. ja testei..
eu não sei como fazer o código na página para mostrar a galeria por categorias.
segue abaixo o código da galeria que eu fiz até agora (lembrando que ela está mostrando as fotos, mas não está separando por categorias.. o que eu queria era que nesta página aparecessem as fotos das categorias apenas, e quando eu clicasse na foto (no caso na categoria) ela entrasse nas fotos que estão cadastradas apenas na categoria selecionada)
<?php require_once('../../Connections/connect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_connect, $connect);
$query_galeria = "SELECT * FROM gcw_galeria ORDER BY gal_id DESC";
$galeria = mysql_query($query_galeria, $connect) or die(mysql_error());
$row_galeria = mysql_fetch_assoc($galeria);
$totalRows_galeria = mysql_num_rows($galeria);
mysql_select_db($database_connect, $connect);
$query_fotos = "SELECT * FROM gcw_galeria_fotos ORDER BY fot_id ASC";
$fotos = mysql_query($query_fotos, $connect) or die(mysql_error());
$row_fotos = mysql_fetch_assoc($fotos);
$totalRows_fotos = mysql_num_rows($fotos);
$query_galeria = "SELECT * FROM gcw_galeria ORDER BY gal_id DESC";
$galeria = mysql_query($query_galeria, $connect) or die(mysql_error());
$row_galeria = mysql_fetch_assoc($galeria);
$totalRows_galeria = mysql_num_rows($galeria);
?>
<?php require_once("../../gcw/inc/auto_load.php"); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- inicio lightbox -->
<link rel="stylesheet" type="text/css" href="../style-projects-jquery.css" />
<!-- Arquivos utilizados pelo jQuery lightBox plugin -->
<script type="text/javascript" src="../../media/js/jquery.js"></script>
<script type="text/javascript" src="../../media/js/jquery.lightbox-0.5.js"></script>
<link rel="stylesheet" type="text/css" href="../../media/css/jquery.lightbox-0.5.css" media="screen" />
<!-- / fim dos arquivos utilizados pelo jQuery lightBox plugin -->
<!-- Ativando o jQuery lightBox plugin -->
<script type="text/javascript">
$(function() {
$('#gallery a').lightBox();
});
</script>
<style type="text/css">
/* jQuery lightBox plugin - Gallery style */
#gallery {
background-color: #444;
padding: 10px;
width: 600px;
}
#gallery ul { list-style: none; }
#gallery ul li { display: inline; }
#gallery ul img {
border: 5px solid #3e3e3e;
border-width: 5px 5px 20px;
}
#gallery ul a:hover img {
border: 5px solid #fff;
border-width: 5px 5px 20px;
color: #fff;
}
#gallery ul a:hover { color: #fff; }
</style>
<!-- fim lightbox -->
<head>
<title>site</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link type="image/x-icon" href="<?php echo HOST_SITE; ?>media/imgs/structure/favicon.ico" rel="shortcut icon" />
<link type="text/css" href="<?php echo HOST_SITE; ?>media/css/structure.css" rel="stylesheet" media="screen" />
<link type="text/css" href="<?php echo HOST_SITE; ?>media/css/interna.css" rel="stylesheet" media="screen" />
<link type="text/css" href="<?php echo HOST_SITE; ?>media/css/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" media="screen" />
<script type="text/javascript" src="<?php echo HOST_SITE; ?>media/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="<?php echo HOST_SITE; ?>media/js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="<?php echo HOST_SITE; ?>media/js/load-home.js"></script>
<!-- Object SWF -->
<script type="text/javascript" src="<?php echo HOST_SITE; ?>media/js/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("<?php echo HOST_SITE; ?>media/swf/contador_regresivo.swf", "contador-regressivo", "530", "65", "9.0.0", "expressInstall.swf");
</script>
</head><!-- ja voui direto ao código da galeria -->
<div align="center" id="gallery">
<?php do { ?>
</MM:DECORATION></MM_REPEATEDREGION>
<a href="../../../../media/imgs/galeria/<?php echo $row_galeria['gal_img']; ?>"><img src="../../../../media/imgs/galeria/<?php echo $row_galeria['gal_img']; ?>" width="100" height="100" /></a>">
<MM_REPEATEDREGION SOURCE="@@rs@@"><MM:DECORATION OUTLINE="Repeat" OUTLINEID=1>
<?php } while ($row_galeria = mysql_fetch_assoc($galeria)); ?>
</a>
</div>
como vocês podem ver ai .. estão sendo mostradas apenas as imagens das galerias... e o que eu quero é que mostrem as imagens pelas categorias que forem sendo exibidas na tela..
bom se alguem não entendeu me avise que tento explicar de outra forma..
vlw galera =)
Discussão (6)
Carregando comentários...