Jump to content

Sorting array of folder list


Peuplarchie

Recommended Posts

Good day to you all,

          I'm working on a script thta list folder in a specific folder.

          My problem is that it won't sort.

 

Here is  my code :

 

 



    
	echo '<div style="width:620px; margin-left:auto; margin-right:auto; padding:0px; ">';
$dirr="Categories/".$cat."/".$val."/";
$dh  = opendir($dirr);
while (false !== ($filename = readdir($dh))) {
if ($filename != "." && $filename != "..") { // remove the move up directory commands. (. and ..)
    $files[] = $filename;

echo '<div style=" width:620px;  margin-left:auto; margin-right:auto; color:#FFFFFF; ">';
echo '<div style=" width:520px; margin-left:auto; margin-right:auto; color:#FFFFFF; float:left;"><img src="snippet_icon.png" border="0"/> '.$filename.'</div><br style="font-size:2px;"/>';
echo '<div style=" width:100px;  margin-left:auto; margin-right:auto; color:#FFFFFF; float:right; text-align:center;">';
echo '<a href="view_snippets.php" onclick="load(\'view_snippets.php?cat='.$cat.'&lang='.$val.'&code='.$filename.'\',\'page\');return false;" title="View Snippet '.$filename.'"><img src="view_icon.png" border="0" title="View Snippet '.$filename.'"/></a>';
echo '</div></div><br>';
}
}
sort ($files); // sort the file list in the array


echo "</div>";

echo "<br/><br/>";





 

Thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.