le 30/03/2013 à 17:04
Pagination
Bonjour
j'ai un souci avec mon code pour ma pagination pouvais vous m'aidez SVP merci d'avance.
je vous m'ai les deux codes
index.php
<?php
//chargement de la fonction pagination
include("pagination.php");
//verification et creation de la variable $page
if(isset($_GET['page']))
{ $page = $_GET['page'];}
else
{$page = 1;};
//inititalisation $max_page
$max_page = 10;
?>
<?php require '../include/header.php';?>
<div align="center">
<?php
pagination($page,
<section id="gallery">
<div id="hiddenresult">
<ul id="zoom">
<li><img id="Tigre Fractal" src="images/photo11.jpg" width="1280" height="800" alt="Tigre Fractal"></li>
<li><img id="Gigabyte" src="images/photo12.jpg" width="1920" height="1080" alt="Gigabyte"></li>
<li><img id="Calypso" src="images/photo13.jpg" width="1600" height="1131" alt="Calypso"></li>
<li><img id="The Legend of Korra" src="images/photo14.jpg" width="1920" height="1080" alt="The Legend of Korra"></li>
<li><img id="Lamborghini" src="images/photo15.jpg" width="1920" height="1200" alt="Lamborghini"></li>
<li><img id="Tigre Lunaire" src="images/photo16.jpg" width="1024" height="768" alt="Tigre Lunaire"></li>
<li><img id="Noctis" src="images/photo17.jpg" width="1920" height="1080" alt="Noctis"></li>
<li><img id="Discovery" src="images/photo18.jpg" width="2200" height="1458" alt="Discovery"></li>
<li><img id="Terre" src="images/photo19.jpg" width="1920" height="1080" alt="Terre"></li>
<li><img id="Paysage" src="images/photo20.JPG" width="1920" height="1080" alt="Paysage"></li>
</ul>
<ul id="thumbs">
<li><a href="#Tigre Fractal"><img src="images/photo1.jpg" width="150" height="94" alt="Tigre Fractal"></a></li>
<li><a href="#Gigabyte"><img src="images/photo2.jpg" width="150" height="94" alt="Gigabyte"></a></li>
<li><a href="#Calypso"><img src="images/photo3.jpg" width="150" height="94" alt="Calypso"></a></li>
<li><a href="#The Legend of Korra"><img src="images/photo4.jpg" width="150" height="94" alt="The Legend of Korra"></a></li>
<li><a href="#Lamborghini"><img src="images/photo5.jpg" width="150" height="94" alt="Lamborghini"></a></li>
<li><a href="#Tigre Lunaire"><img src="images/photo6.jpg" width="150" height="94" alt="Tigre Lunaire"></a></li>
<li><a href="#Noctis"><img src="images/photo7.jpg" width="150" height="94" alt="Noctis"></a></li>
<li><a href="#Discovery"><img src="images/photo8.jpg" width="150" height="94" alt="Discovery"></a></li>
<li><a href="#Terre"><img src="images/photo9.jpg" width="150" height="94" alt="Terre"></a></li>
<li><a href="#Paysage"><img src="images/photo21.JPG" width="150" height="94" alt="Paysage"></a></li>
</ul>
</div>
</section>
);
?>
</div>
<?php require '../include/footer.php';
?>
pagination.php
<?php
function pagination($page, $max_page)
{
if ($max_page > 1)
{
if ($page == 1)
{
echo "<img src=\"back.png\" border=\"0\">";
}
else
{
echo "<a href=\"index.php?page=".($page-1)."\">";
echo "<img src=\"back.png\" border=\"0\">";
echo "</a>";
}
for ($i = 1; $i <= $max_page; $i++)
{
if ($i == $page)
{
echo " ".$i." ";
}
else
{
echo "<a href=\"index.php?page=".$i."\">";
echo " ".$i." ";
echo "</a>";
}
}
if ($page == $max_page)
{
echo "<img src=\"next.png\" border=\"0\">";
}
else
{
echo "<a href=\"index.php?page=".($page+1)."\">";
echo "<img src=\"next.png\" border=\"0\">";
echo"</a>";
}
}
}
?>
j'ai un souci avec mon code pour ma pagination pouvais vous m'aidez SVP merci d'avance.
je vous m'ai les deux codes
index.php
<?php
//chargement de la fonction pagination
include("pagination.php");
//verification et creation de la variable $page
if(isset($_GET['page']))
{ $page = $_GET['page'];}
else
{$page = 1;};
//inititalisation $max_page
$max_page = 10;
?>
<?php require '../include/header.php';?>
<div align="center">
<?php
pagination($page,
<section id="gallery">
<div id="hiddenresult">
<ul id="zoom">
<li><img id="Tigre Fractal" src="images/photo11.jpg" width="1280" height="800" alt="Tigre Fractal"></li>
<li><img id="Gigabyte" src="images/photo12.jpg" width="1920" height="1080" alt="Gigabyte"></li>
<li><img id="Calypso" src="images/photo13.jpg" width="1600" height="1131" alt="Calypso"></li>
<li><img id="The Legend of Korra" src="images/photo14.jpg" width="1920" height="1080" alt="The Legend of Korra"></li>
<li><img id="Lamborghini" src="images/photo15.jpg" width="1920" height="1200" alt="Lamborghini"></li>
<li><img id="Tigre Lunaire" src="images/photo16.jpg" width="1024" height="768" alt="Tigre Lunaire"></li>
<li><img id="Noctis" src="images/photo17.jpg" width="1920" height="1080" alt="Noctis"></li>
<li><img id="Discovery" src="images/photo18.jpg" width="2200" height="1458" alt="Discovery"></li>
<li><img id="Terre" src="images/photo19.jpg" width="1920" height="1080" alt="Terre"></li>
<li><img id="Paysage" src="images/photo20.JPG" width="1920" height="1080" alt="Paysage"></li>
</ul>
<ul id="thumbs">
<li><a href="#Tigre Fractal"><img src="images/photo1.jpg" width="150" height="94" alt="Tigre Fractal"></a></li>
<li><a href="#Gigabyte"><img src="images/photo2.jpg" width="150" height="94" alt="Gigabyte"></a></li>
<li><a href="#Calypso"><img src="images/photo3.jpg" width="150" height="94" alt="Calypso"></a></li>
<li><a href="#The Legend of Korra"><img src="images/photo4.jpg" width="150" height="94" alt="The Legend of Korra"></a></li>
<li><a href="#Lamborghini"><img src="images/photo5.jpg" width="150" height="94" alt="Lamborghini"></a></li>
<li><a href="#Tigre Lunaire"><img src="images/photo6.jpg" width="150" height="94" alt="Tigre Lunaire"></a></li>
<li><a href="#Noctis"><img src="images/photo7.jpg" width="150" height="94" alt="Noctis"></a></li>
<li><a href="#Discovery"><img src="images/photo8.jpg" width="150" height="94" alt="Discovery"></a></li>
<li><a href="#Terre"><img src="images/photo9.jpg" width="150" height="94" alt="Terre"></a></li>
<li><a href="#Paysage"><img src="images/photo21.JPG" width="150" height="94" alt="Paysage"></a></li>
</ul>
</div>
</section>
);
?>
</div>
<?php require '../include/footer.php';
?>
pagination.php
<?php
function pagination($page, $max_page)
{
if ($max_page > 1)
{
if ($page == 1)
{
echo "<img src=\"back.png\" border=\"0\">";
}
else
{
echo "<a href=\"index.php?page=".($page-1)."\">";
echo "<img src=\"back.png\" border=\"0\">";
echo "</a>";
}
for ($i = 1; $i <= $max_page; $i++)
{
if ($i == $page)
{
echo " ".$i." ";
}
else
{
echo "<a href=\"index.php?page=".$i."\">";
echo " ".$i." ";
echo "</a>";
}
}
if ($page == $max_page)
{
echo "<img src=\"next.png\" border=\"0\">";
}
else
{
echo "<a href=\"index.php?page=".($page+1)."\">";
echo "<img src=\"next.png\" border=\"0\">";
echo"</a>";
}
}
}
?>