Afisare foto in mai multe pagini
Scris: Lun Feb 03, 2014
Deci, am un folder in care am incarcat toate fotografiile pentru a folosi Fancybox. Toate bune, functioneaza, insa nu stiu cum sa fac ca aceste foto sa fie luate si impartite automat in mai multe pagini, cate 20 foto/pagina. In prezent, am creat 10 pagini distincte cu cate 20 foto fiecare. Mentionez ca in site am deja un cod pentru dividere in pagini dar nu stiu cum sa-l aplic la ceeace doresc sa fac.
Fotografiile le chem asa:
Afisarea de pagini este:
Codul pagini este:
Multumesc anticipat !
Fotografiile le chem asa:
Cod: Selectaţi tot
<script type="text/javascript">
$(document).ready(function() {
$('#gallery a').fancybox();
});
</script>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="">
<tr>
<td>
<div id="gallery">
<a href="images/proiecte/01_big.jpg" rel="gallery" title=""><img src="images/proiecte/01_small.jpg" alt=""></a>
<a href="images/proiecte/02_big.jpg" rel="gallery" title=""><img src="images/proiecte/02_small.jpg" alt=""></a>
<a href="images/proiecte/03_big.jpg" rel="gallery" title=""><img src="images/proiecte/03_small.jpg" alt=""></a>
......................................................................................................................................
</div>
</td></tr></table>
Afisarea de pagini este:
Cod: Selectaţi tot
<p align="right" style="padding-top : 10px">Pagina: <? Navigation::display($total_rows,$page,$limit,$this_script); ?></p>
Cod: Selectaţi tot
class Navigation
{
// $total_rows = total rows
// $page = current page, if(empty($_GET['page'])) $page=1; else $page = $_GET['page'];
// $limit = number of rows per page, $limit != 0
// $this_script = file name, it must finish with '?' or '&'
public function __construct()
{
//..
}
static function display_admin($total_rows,$page,$limit,$this_script) // first page = 1
{
if(empty($page)) $page=1;
if($page > 1)
{
echo "<a href='".$this_script."page=".($page-1)."'> « </a> ";
}
for($i=1;$i<=ceil($total_rows/$limit);$i++)
{
if($i == $page)
echo '<span class="pageListing_fundal">'.$i."</span> ";
else
echo "<a href='".$this_script."page=".$i."' class='pageListing'>".$i."</a> ";
}
if($page < ($total_rows/$limit))
{
echo "<a href='".$this_script."page=".($page+1)."' > »</a> ";
}
}
static function display($total_rows,$page,$limit,$this_script) // first page = 1
{
if(empty($page)) $page=1;
if($page > 1)
{
echo "<a href='".$this_script."page=".($page-1)."'> « </a> ";
}
for($i=1;$i<=ceil($total_rows/$limit);$i++)
{
if($i == $page)
echo '<span class="page">'.$i."</span> ";
else
echo "<a href='".$this_script."page=".$i."'class='LinkPageListing'>".$i."</a> ";
}
if($page < ($total_rows/$limit))
{
echo "<a href='".$this_script."page=".($page+1)."' > »</a> ";
}
}
}
?>