Guest User

Untitled

a guest
Mar 1st, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. ////////////////////////////////////////////////
  4. /////////////////////////////
  5. ////////////////////////////////////////////////
  6. /////////////////////////////
  7. //// affichage des noms dans la cellule de mon tableau acteurs/actrices /////
  8. ////////////////////////////////////////////////
  9. /////////////////////////////
  10. ////////////////////////////////////////////////
  11. /////////////////////////////
  12. $Nom_ACTORS = "";
  13. $ACTORS = $row_Only_sur_CD['ACTORS'];
  14. $longueur_ACTORS = strlen($ACTORS);
  15. $ACTORSpresents = array();
  16. $i = 0;
  17. $j = 0;
  18. $maxVIRGULE = 0;
  19. $maxj = 0;
  20. $maxVIRGULE = count((explode(",", $ACTORS)));
  21. //affiche tous les acteurs/actrices sans leur extension
  22.  
  23. if ($longueur_ACTORS > 0) {
  24.     while ($i < $longueur_ACTORS) {
  25.         if (isset($ACTORS)) {
  26.             if (explode(",", $ACTORS)) {
  27.                 if ($maxVIRGULE != $j) {
  28.                     $ACTORSpresents = (explode(", ", $ACTORS));
  29.                     echo $ACTORSpresents[$j] . "-";
  30.                     $maxj = $j;
  31.                     $j++;
  32.                 }
  33.             }
  34.             $i++;
  35.         }
  36.     }
  37. }
  38. ?>
  39.  
  40. <?php
  41.  
  42. ////////////////////////////////////////////////
  43. //
  44. ////////////////////////////////////////////////
  45. //
  46. ////affichage des photos des acteurs/actrices ////
  47. ////////////////////////////////////////////////
  48. //
  49. ////////////////////////////////////////////////
  50. //
  51.  
  52. $NOM = array();
  53. $compteur = 0;
  54. $i = 0;
  55. $compt = 0;
  56. $debutEXTENSION = ".";
  57. $image = array();
  58. $compteur = 0;
  59. $comptage = 0;
  60. $imageACTORS_sans_extension = array();
  61.  
  62. // répertoire des images
  63. $dir = "../../../ADULTES sur CD/Acteurs et Actrices/";
  64. $RepertoireNOM = opendir($dir); // ouverture du repertoire
  65. ////////////////////////////////////////////
  66. //// AFFICHAGE des acteurs et actrices /////
  67. ////////////////////////////////////////////
  68. while ($Nom_ACTORS = readdir($RepertoireNOM)) {
  69.     if (!is_file($Nom_ACTORS) && ($Nom_ACTORS != "index.php")) {
  70. //on stocke le nom des fichiers des photos dans un tableau
  71.         $tableau[$compt] = $Nom_ACTORS;
  72. // On a stocké un nom, donc on incrémente maintenant
  73.         $compt++;
  74.     }
  75. }
  76.  
  77. closedir($RepertoireNOM);
  78.  
  79. // Ensuite pourquoi compter les photos ? On sait qu'on a $compt //
  80. if ($compt > 0) {
  81.     echo '<table>';
  82. // et on fait une boucle d'affichage
  83.     for ($i = 0; $i < $compt; $i++) {
  84. //echo $tableau[$i]."</br>";
  85.     }
  86. }
  87.  
  88. if ($compt > 0) {
  89.     $nbcol = 8; // nombre de colonnes (pour les images.... - On compte le nombre de photos qui se trouve dans le dossier
  90.     $nbpics = count($tableau);
  91. //$dir=opendir($RepertoireNOM);
  92.  
  93.     if ($ACTORS != "") {
  94.         $ACTORSpresents = explode(", ", ", " . $ACTORS);
  95.         echo "CASTING :<br/>Il y a " . (sizeof($ACTORSpresents) - 1) . " Acteurs/Actrices";
  96.         echo "<table>";
  97.  
  98.         $nbcol = 7;
  99.         for ($i = 1; $i < sizeof($ACTORSpresents); $i++) {
  100.             if ($i % $nbcol == 1) {
  101.                 echo "<tr>";
  102.             }
  103.             $extension = "";
  104.             if (is_file($RepertoireNOM . $ACTORSpresents[$i] . ".jpg")) {
  105.                 $extension = ".jpg";
  106.             } elseif (is_file($RepertoireNOM . $ACTORSpresents[$i] . ".png")) {
  107.                 $extension = ".png";
  108.             } elseif (is_file($RepertoireNOM . $ACTORSpresents[$i] . ".jpeg")) {
  109.                 $extension = ".jpeg";
  110.             } elseif (is_file($RepertoireNOM . $ACTORSpresents[$i] . ".gif")) {
  111.                 $extension = ".gif";
  112.             } else {
  113.                 $extension = "";
  114.             }
  115.             echo "<td>";
  116.  
  117.             if ($extension != "") {
  118.                 echo "<img src='" . $rep . $ACTORSpresents[$i] . $extension . "' width=150 height=180>";
  119.             } else {
  120.                 echo "Aucune photo pour<br/>";
  121.             }
  122.             echo "<br/>" . $ACTORSpresents[$i] . "</td>";
  123.  
  124.             if ($i % $nbcol == 0) {
  125.                 echo "</tr>";
  126.             }
  127.         }
  128.         echo "</table>";
  129.     }
  130.  
  131. //si on a au moins une photo, on les affiche toutes
  132.     if ($nbpics != 0) {
  133.         echo '<table>';
  134.     }
  135.  
  136.  
  137.     while ($comptage = !$maxj) {
  138.         echo $ACTORSpresents[$i] . "</br>";
  139.         echo $tableau[$comptage] . "</br>";
  140.         if (($ACTORSpresents[$i]) == ($tableau[$compteur])) {
  141.             if ($i % $nbcol != 0) {
  142.                 echo '<tr>';
  143.             } {
  144.                 echo '<img src="../../ADULTES sur CD/Acteurs et Actrices/' . $tableau[$compteur] . '"/>';
  145.                 echo $tableau[$compteur]; // pour voir si il est ok
  146.                 $comptage = 0;
  147.                 $i++;
  148.             }
  149.             if ($i % $nbcol == ($nbcol - 1)) {
  150.                 echo '</tr>';
  151.             }
  152.             $compteur++;
  153.         }
  154.         $comptage++;
  155.     }
  156.  
  157.     echo '</table>';
  158. }
  159. else
  160.     echo 'Aucune image à afficher';
  161. ?>
Advertisement
Add Comment
Please, Sign In to add comment