Note that there are some explanatory texts on larger screens.

plurals
  1. PO[ solver } Sort gallery By date
    primarykey
    data
    text
    <p>I have a problem, I created a gallery it works perfectly but The function which sort the images depends on they DAY only it ignores the mouths and minutes ... The form used for the sort is ::::: | <strong>d/m/Y H:i:s</strong> |, but when I move to another mouth I lose the order because it depends only on the day as I said I want it to take in consideration the mouth too. </p> <pre> $date = date ("d/m/Y H:i:s",filemtime($dir_mini)); function sortFunctionASC ( $a , $b ) { return strcmp($a["date"], $b["date"]); } </pre> <p>And here I give the part which sort the gallery </p> <pre><code>//Boucle sur le répertoire On extrait aussi le Nom de l'image et de la miniature $images = array(); while ( false !== ($Fichier = readdir($ouverture))) { $berk = array('.', '..'); $dir_mini = $dos_mini.$Fichier; $dir_img = $dos_img.$Fichier; $img_name = $dir_mini ; $img_name = preg_replace('#jpg|png|jpg|mini|/|\.#i', '',$img_name); $date_precise = date ("d/F/Y-H:i",filemtime($dir_mini)); $date = date ("d/m/Y H:i:s",filemtime($dir_mini)); if(!in_array($Fichier, $berk) AND !is_dir($dir_mini) AND !is_dir($dir_img) ) { $image = array(); $image['date_precise'] = $date_precise; $image['date'] = $date; $image['img'] = $dir_img; $image['thumb'] = $dir_mini; $images[] = $image; } } closedir($ouverture); // Cette deux fonctions trient les images en fonction de date ASC croissant, DESC décroissant function sortFunctionASC ( $a , $b ) { return strcmp($a["date"], $b["date"]); } function sortFunctionDESC( $b , $a ) { return strcmp($a["date"], $b["date"]); } if (isset ($_GET['ASC'])) { usort ($images,"sortFunctionASC"); } if (isset ($_GET['DESC'])) { usort ($images,"sortFunctionDESC"); } if (!isset($_GET['ASC']) AND !isset($_GET['DESC'])) { usort ($images,"sortFunctionDESC") ;} </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload