Pfad Modul alphabetisch

Gesperrt
hypekermit
Beiträge: 213
Registriert: Mi 9. Okt 2002, 21:24
Kontaktdaten:

Pfad Modul alphabetisch

Beitrag von hypekermit » Di 27. Jun 2006, 12:48

ich habe das pfad modul von andreas kummer im einsatz...
ist es möglich hier eine alhabteische ausgabe zurück zubekommen???


Code: Alles auswählen



?><?php 
/** 
  * $Revision: 1.3 $ 
  * $Source: D:/cvs/cvsrepo/test/PPI_Nade/module/picture/input.php,v $ 
  * $Date: 2005/11/29 16:10:51 $ 
  */ 

/** 
 * picture 
 * @author Andreas Kummer 
 * @copyright Copyright &copy; 2005 w3concepts AG 
 */ 

if (!class_exists('pictureInput')) { 
    
   class pictureInput { 
    
      function pictureInput($pfad) { 
         $this->pfad = $pfad; 
         $this->pathlen = strlen($this->pfad); 
      } 
    
      function getPath($root,$level = 0) { 
         $content = $this->readDir($root); 
    
         foreach ($content as $file) { 
            if (is_dir($root.$file)) { 
               $verzeichnis = substr($root,$this->pathlen); 
               $returnvalue["{$verzeichnis}{$file}/"] = str_repeat("&nbsp;",$level * 5).$file; 
               $returnvalue = array_merge((array)$returnvalue,(array)$this->getPath($root.$file."/",$level+1)); 
             // $returnvalue = array_merge($returnvalue,$this->getPath($root.$file."/",$level+1)); 
            } 
         } 
    
         return $returnvalue; 
      } 
    
   function readDir($path) { 
      $handle = opendir($path); 

      while ($file = readdir ($handle)) { 
         if ($file != "." && $file != "..") $returnvalue[] = $file; 
      } 
      closedir($handle); 

      return $returnvalue; 
   }  
    
   function makeSelect($preselection) { 
      $pfad = $this->getPath($this->pfad); 

      foreach ($pfad as $key => $value) { 
         if ($preselection == $key) { 
            echo "<option value=\"$key\" selected=\"selected\">$value</option>"; 
         } else { 
            echo "<option value=\"$key\">$value</option>"; 
         } 
         } 
      } 
   } 
} 

$pfad = new pictureInput($cfgClient[$client]['path']['frontend'].$cfgClient[$client]['upload']); 
echo "<table cellspacing=\"0\" cellpadding=\"10\" border=\"0\">"; 

echo "<tr><td>Bildzielpfad:</td>"; 
echo "<td><select size=\"1\" name=\"CMS_VAR[0]\" />"; 
$pfad->makeSelect("CMS_VALUE[0]"); 
echo "</td></tr>"; 

echo "</table>";


php0815
Beiträge: 373
Registriert: Mi 26. Okt 2005, 12:12
Wohnort: Schwarzwald
Kontaktdaten:

Beitrag von php0815 » Di 27. Jun 2006, 13:38

Wie wärs wenn du das Array sortierst
In der Ruhe liegt die Kraft den wer suchet der findet
Wer Rechtschreibfehler findet kann sie behalten, Codefehler können gemeldet werden.

phpchris
Beiträge: 438
Registriert: Fr 28. Mai 2004, 16:07
Kontaktdaten:

Beitrag von phpchris » Di 27. Jun 2006, 14:25

Hehehe, ein wenig off-topic aber bei der Überschrift dachte ich an eine Breadcrumb-Navigation, die alphabetisch sortiert werden soll :lol: :lol: :lol:

Gesperrt