Je suis presque sur de moi pourtant, alors pour mieux y voir j' ai fait mi html et mi php, je convertirait tout en php une fois le code operationnel a 100%. la derniere partie est celle qui nous interesse en bas de page avec le:
<?php
}
elseif(isset($_GET['f']))
{
?>
J tiens a signaler qu' il faut imperativement la variable c=dwld, mais la n' est pas le souci, c' est pour que vous y voyiez bien clair.
1 partie: if((!isset($_GET['sc']))&&(!isset($_GET['t'])))
Si les variables sous-cat et type ne sont pas la, on affiche toutes les catégories ----->OK
2eme partie : elseif((isset($_GET['sc']))&&(!isset($_GET['t'])))
Si il y a juste la variable csous-cat, on affiche une boucle avec la liste de tous les films ----->OK
3eme partie : elseif((isset($_GET['sc']))&&(isset($_GET['t'])))
Si on a une sous-cat (films en l' occurence) et un type (action, humour, etc) on affiche la liste des films correspondant a la selection faite avant pa rle visiteur ----> OK
et enfin 4eme partie : elseif(isset($_GET['f']))
On affiche la fiche du film choisit (f=id) ------>GROS PROBLEME, ON REVIENT A A LA PREMIERE PARTIE
<?php
session_start();
if(!isset($_SESSION['name']))
{
echo '<meta http-equiv="Refresh" content="0;URL=index.php?c=noconnect">';
die;
}
?>
<?php
$type = $_GET['t'];
$sc = $_GET['sc'];
$f = $_GET['f'];
$messagesParPage=30; //Nous allons afficher 5 messages par page.
$retour_total=mysql_query('SELECT COUNT(*) AS id FROM films'); //Nous récupérons le contenu de la requête dans $retour_total
$donnees_total=mysql_fetch_assoc($retour_total); //On range retour sous la forme d'un tableau.
$total=$donnees_total['id']; //On récupère le total pour le placer dans la variable $total.
//Nous allons maintenant compter le nombre de pages.
$nombreDePages=ceil($total/$messagesParPage);
if((!isset($_GET['sc']))&&(!isset($_GET['t'])))
{
?>
<table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10" background="images/menus/ch.png"></td>
</tr>
<tr>
<td height="105" align="center" valign="middle" background="images/menus/cm.png"><table width="538" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="35" background="../images/titres/v.png"><table width="510" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>• <a href="index.php?c=dwld&sc=films">Tous les films </a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td height="20"><table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=action">Action</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=animation">Animation</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=artsmartiaux">Arts martiaux </a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=aventure">Aventure</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=biopic">Biopic</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=comedie">Comédie</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=documentaire">Documentaire</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=drame">Drame</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=espionnage">Espionnage</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=fantastique">Fantastique</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=guerre">Guerre</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=horreur">Horreur</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=musical">Musical</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=policier">Policier</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=romance">Romance</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=sf">Science-Fiction</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=spectacle">Spectacle</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=thriller">Thriller</a></td>
</tr>
<tr>
<td height="22" align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&sc=films&t=western">Western</a></td>
</tr>
</table></td>
</tr>
</table>
<br />
<table width="538" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="35" background="../images/titres/v.png"><table width="510" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>• <a href="index.php?c=dwld&sc=appl">Applications </a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="10"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="10" background="images/menus/cb.png"></td>
</tr>
</table>
<?php
}
elseif((isset($_GET['sc']))&&(!isset($_GET['t'])))
{
?>
<table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10" background="images/menus/ch.png"></td>
</tr>
<tr>
<td height="82" align="center" valign="top" background="images/menus/cm.png"><table width="538" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="35" background="../images/titres/v.png"><table width="510" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><span class="rougeg">• Tous les films</span></td>
</tr>
</table></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td height="20">
<?php
if(isset($_GET['page'])) // Si la variable $_GET['page'] existe...
{
$pageActuelle=intval($_GET['page']);
if($pageActuelle>$nombreDePages) // Si la valeur de $pageActuelle (le numéro de la page) est plus grande que $nombreDePages...
{
$pageActuelle=$nombreDePages;
}
}
else // Sinon
{
$pageActuelle=1; // La page actuelle est la n°1
}
$premiereEntree=($pageActuelle-1)*$messagesParPage; // On calcul la première entrée à lire
$films2 = mysql_query('SELECT * FROM films WHERE "'.$sc.'" = "films" ORDER BY id DESC LIMIT '.$premiereEntree.', '.$messagesParPage.'');
while ($films = mysql_fetch_array($films2))
{
?><table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&f=<?php echo $films['id']; ?>"><?php echo $films['titre']; ?></a></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10" background="images/menus/cb.png"></td>
</tr>
</table>
<?php
}
echo '<table width="100% border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20" class="gh"> </td>
</tr>
<tr>
<td height="19" align="center" valign="top" class="gm">Page : '; //Pour l'affichage, on centre la liste des pages
for($i=1; $i<=$nombreDePages; $i++) //On fait notre boucle
{
//On va faire notre condition
if($i==$pageActuelle) //Si il s'agit de la page actuelle...
{
echo ' [ '.$i.' ] ';
}
else //Sinon...
{
echo ' <a href="index.php?page='.$i.'">'.$i.'</a>';
}
}
echo '</td>
</tr>
<tr>
<td height="20" class="gb"> </td>
</tr>
</table>';
?>
<?php
}
elseif((isset($_GET['sc']))&&(isset($_GET['t'])))
{
?>
<table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10" background="images/menus/ch.png"></td>
</tr>
<tr>
<td height="82" align="center" valign="top" background="images/menus/cm.png"><table width="538" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="35" background="../images/titres/v.png"><table width="510" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><span class="rougeg">• <?php echo ucfirst($type); ?></span></td>
</tr>
</table></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td height="20">
<?php
if(isset($_GET['page'])) // Si la variable $_GET['page'] existe...
{
$pageActuelle=intval($_GET['page']);
if($pageActuelle>$nombreDePages) // Si la valeur de $pageActuelle (le numéro de la page) est plus grande que $nombreDePages...
{
$pageActuelle=$nombreDePages;
}
}
else // Sinon
{
$pageActuelle=1; // La page actuelle est la n°1
}
$premiereEntree=($pageActuelle-1)*$messagesParPage; // On calcul la première entrée à lire
$films2 = mysql_query('SELECT * FROM films WHERE type = "'.$type.'" ORDER BY id DESC LIMIT '.$premiereEntree.', '.$messagesParPage.'');
while ($films = mysql_fetch_array($films2))
{
?><table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /><a href="index.php?c=dwld&f=<?php echo $films['id']; ?>"><?php echo $films['titre']; ?></a></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10" background="images/menus/cb.png"></td>
</tr>
</table>
<?php
}
echo '<table width="100% border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20" class="gh"> </td>
</tr>
<tr>
<td height="19" align="center" valign="top" class="gm">Page : '; //Pour l'affichage, on centre la liste des pages
for($i=1; $i<=$nombreDePages; $i++) //On fait notre boucle
{
//On va faire notre condition
if($i==$pageActuelle) //Si il s'agit de la page actuelle...
{
echo ' [ '.$i.' ] ';
}
else //Sinon...
{
echo ' <a href="index.php?page='.$i.'">'.$i.'</a>';
}
}
echo '</td>
</tr>
<tr>
<td height="20" class="gb"> </td>
</tr>
</table>';
?>
<?php
}
elseif(isset($_GET['f']))
{
?>
<table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10" background="images/menus/ch.png"></td>
</tr>
<tr>
<td height="82" align="center" valign="top" background="images/menus/cm.png"><table width="538" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="35" background="../images/titres/v.png"><table width="510" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><span class="rougeg">titre</span></td>
</tr>
</table></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td height="20">
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle">¬<img src="../images/blank.png" width="10" height="1" /></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10" background="images/menus/cb.png"></td>
</tr>
</table>
<?php
}
?>