Witam,
Pisze galerie zdjęć i chce właśnie coś takiego u siebie zrobić...jak jest w większości galeri.
Chodzi mi o to aby w każdym wierszu były 3 miniaturki zdjęć.
np.
nie tak:
zdjęcie
zdjęcie
zdjęcie
tylko tak:
zdjęcie zdjęcie zdjęcie
zdjęcie zdjęcie zdjęcie
Narazie zrobiłem taki skrypt:
php:
<?php
$template->assign_body('gallery.tpl', 'ma');
$sql = "SELECT id, title, name, data FROM " . GALLERY_TABLE . " ORDER BY date";
{
$y = $image[1];
$x = $image[0];
if($x > $y){
$nx = 100;
$ny = 100 * ($y / $x);
}elseif($x < $y){
$nx = 100 * ($x / $y);
$ny = 100;
}else{
$nx = 100;
$ny = 100;
}
$template->assign_loop_vars('gallery', array( 'NAME' => $gallery['name'],
'ID' => $gallery['id'],
'NX' => $nx,
'NY' => $ny,
'TITLE' => $gallery['title'],
'DATA' => $gallery['data'],
));
$how++;
if($how == 3)
{
$template->assign_loop_vars('gallery.br', array( 'BR' => '</tr><tr>'
));
$how = 0;
}
}
$template->display_body();
?>
i szablon
<table align="center" width="100%" cellpadding="0" cellspacing="0" border="0"> <!-- BEGIN gallery -->
<table align="center" width="100%" cellpadding="0" cellspacing="0" border="0"> <td align="center"><img src="images/{gallery.NAME}" style="border: 2px #d0d0d0 solid" width="{gallery.NX}" height="{gallery.NY}"></td> <td align="center"><A href="#" onclick="java script:otworz('show.php?id={gallery.ID}');">Zobacz
</a></td> <td align="center"><b>{gallery.TITLE}
</b></td> <td align="center">Data: {gallery.DATA}
</td> <!-- BEGIN br -->
{gallery.br.BR}
<!-- END br -->
<!-- END gallery -->
<td height="5"> </td>
ale niestety to nie działa...:/
Ten post edytował eunix 1.09.2006, 09:26:49