Foros del Web » Programando para Internet » PHP »

[APORTE] Crear árbol de directorios

Estas en el tema de [APORTE] Crear árbol de directorios en el foro de PHP en Foros del Web. Una forma sencilla de crear un árbol de directorios con PHP @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código PHP: Ver original <?php if ( ! defined ( 'PATH' ) ...
  #1 (permalink)  
Antiguo 29/11/2010, 07:17
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 11 meses
Puntos: 1517
[APORTE] Crear árbol de directorios

Una forma sencilla de crear un árbol de directorios con PHP
Código PHP:
Ver original
  1. <?php
  2. if(!defined('PATH')){
  3.     define('PATH', __DIR__ . DIRECTORY_SEPARATOR);
  4. }
  5.  
  6. function getFile($root, $n = 0){
  7.     $onlyDirs = array();
  8.     $onlyFiles = array();
  9.     $n++;
  10.  
  11.     foreach(glob($root . '/*', GLOB_NOSORT) as $file){
  12.         $f = pathInfo($file);
  13.         if(is_dir($file)){
  14.             /**
  15.              * Verifica si el nombre del directorio es solo número, añade un espacio
  16.              * al final del nombre para mantener la llave cuando use array_merge
  17.              */
  18.             $key = is_numeric($f['basename']) ? $f['basename'] . ' ' : $f['basename'];
  19.             $onlyDirs[$key] = array(
  20.                                 'real_path' => realpath($f['dirname'] . DIRECTORY_SEPARATOR . $f['basename']),
  21.                                 'n_array' => $n,
  22.                                 'files_in_dir' => getFile($file, $n)
  23.                             );
  24.         }
  25.         else{
  26.             $onlyFiles[$f['basename']] = array(
  27.                                             'real_path' => realpath($f['dirname'] . DIRECTORY_SEPARATOR . $f['basename']),
  28.                                             'http_path' => str_replace(array('//', '\\'), '/', $f['dirname'] . '/') . $f['basename'],
  29.                                             'n_array' => $n,
  30.                                             'pathInfo' => pathInfo($file),
  31.                                             'timeModified' => date('m-d-Y H:i:s', filemtime($file))
  32.                                         );
  33.         }
  34.     }
  35.     return array_merge($onlyDirs, $onlyFiles);
  36. }
  37.  
  38. function setFile($files){
  39.     $customFile = '';
  40.     foreach($files as $key => $file){
  41.         if(is_array($file) && $key != 'pathInfo'){
  42.             if($key != 'files_in_dir'){
  43.                 $tab = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $file['n_array']);
  44.                 $type = empty($file['pathInfo']) ? '[' . trim($key) . ']' : trim($key);
  45.                 $customFile .= $tab . $type . '<br />';
  46.             }
  47.             $customFile .= setFile($file);
  48.         }
  49.     }
  50.     return $customFile;
  51. }
  52.  
  53. /**
  54.  * Puedes especificar un directorio o simplemente,
  55.  * lo dejas vacío para verificar desde donde está corriendo el código
  56.  */
  57. echo setFile(getFile(PATH . 'directorio'));

Nota:
2010-12-03: Corregir código
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos

Última edición por abimaelrc; 09/03/2011 a las 16:11 Razón: Correcciones
  #2 (permalink)  
Antiguo 29/11/2010, 07:39
Colaborador
 
Fecha de Ingreso: octubre-2009
Ubicación: Tokyo - Japan !
Mensajes: 3.867
Antigüedad: 14 años, 6 meses
Puntos: 334
Respuesta: [APORTE] Crear árbol de directorios

gracias..
se ve bastante bien..
lo revisare haber que tal =)
__________________
More about me...
~ @rhyudek1
~ Github
  #3 (permalink)  
Antiguo 24/12/2010, 10:37
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 11 meses
Puntos: 1517
Respuesta: [APORTE] Crear árbol de directorios

Inventando con el código, esto es lo que he podido hacer adicional. En este código le estoy indicando que lea solamente los archivos pdf, ustedes lo pueden colocar a la manera que quieran
index.php o index.html
Código HTML:
Ver original
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
  2. <frameset cols="20%,80%">
  3.   <frame src="directories.php" />
  4.   <frame src="blank.php" name="content" />
  5. </frameset>
  6. </html>

directories.php
Código PHP:
Ver original
  1. <?php require_once 'class.php'; ?>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <script type="text/javascript" src="script.js"></script>
  6. <link type="text/css" rel="stylesheet" href="style.css" />
  7. </head>
  8. <body>
  9.     <?php
  10.         $dirStructure = new DirStructure(array('pdf'));
  11.  
  12.         /**
  13.          * The next line you can specified the directory that you want to check,
  14.          * if not specified it will check the current directory
  15.          */
  16.         echo $dirStructure->getFile($dirStructure->setFile($dirStructure->path('docs')));
  17.     ?>
  18. <div id="tree_notification">Cargando...</div>
  19. </body>
  20. </html>

class.php
Código PHP:
Ver original
  1. <?php
  2. class DirStructure{
  3.     /**
  4.      * Avoid using .. /, so you can not go back
  5.      * Default false
  6.      */
  7.     private $_safeMode = false;
  8.  
  9.     /**
  10.      * Hide all directories that do not have any files,
  11.      * even if there are other directories that are empty
  12.      * Default true
  13.      */
  14.     private $_hideEmptyDir = true;
  15.  
  16.     /**
  17.      * Show only this extentions. Format: mime type
  18.      * application/pdf              PDF
  19.      * application/zip              DOCX|XLSX|PPTX|...
  20.      * application/octet-stream         ZIP
  21.      * application/x-rar            RAR
  22.      * text/x-php               PHP
  23.      * text/html                    HTML/HTM
  24.      * application/x-empty          (empty files)
  25.      *
  26.      * Example of how it will be set:
  27.      * $_fInfoExt = array('application/pdf', 'application/zip', 'text/x-php');
  28.      *
  29.      * Leave blank if you want to display all
  30.      * $_fInfoExt = array();
  31.      *
  32.      * @param array $array
  33.      */
  34.     private $_realExt = array(
  35.                             'pdf' => 'application/pdf',
  36.                             'docx' => 'application/zip',
  37.                             'xlsx' => 'application/zip',
  38.                             'pptx' => 'application/zip',
  39.                             'zip' => 'application/octet-stream',
  40.                             'rar' => 'application/x-rar',
  41.                             'php' => 'text/x-php',
  42.                             'html' => 'text/html',
  43.                             'empty files' => 'application/x-empty',
  44.                         );
  45.     private $_fInfoExt = array();
  46.  
  47.     public function __construct(array $array = array()){
  48.         foreach($array as $value){
  49.             $this->_fInfoExt[] = array_key_exists($value, $this->_realExt)
  50.                 ? $this->_realExt[$value]
  51.                 : $value;
  52.         }
  53.     }
  54.  
  55.     /**
  56.      * Set path for current directory so this scripts works if include in another php file
  57.      *
  58.      * @param string $dir
  59.      * @return string
  60.      */
  61.     public function path($dir){
  62.         if($this->_safeMode){ $dir = str_replace('../', '', $dir); }
  63.         return realpath(__DIR__ . DIRECTORY_SEPARATOR . $dir);
  64.     }
  65.  
  66.     /**
  67.      * Check for real mime extention
  68.      *
  69.      * @param string $fileUrl Set file to check
  70.      * @return string
  71.      */
  72.     private function _whatMimeExt($fileUrl = null){
  73.         if(empty($fileUrl)){ return; }
  74.  
  75.         $fInfo = finfo_open(FILEINFO_MIME_TYPE);
  76.         $mimeExtention = finfo_file($fInfo, $fileUrl);
  77.         finfo_close($fInfo);
  78.  
  79.         return $mimeExtention;
  80.     }
  81.  
  82.     /**
  83.      * Check if is real extention
  84.      *
  85.      * @param string $fileUrl Set file to check
  86.      * @param array $ext Extention(s) to check. Format: Mime type
  87.      * @return bool
  88.      */
  89.     private function _realExtFile($fileUrl, array $ext = array()){
  90.         if(empty($ext)){ return false; }
  91.  
  92.         foreach($ext as $e){
  93.             if(is_file($fileUrl) && $this->_whatMimeExt($fileUrl) != $e){ return true; }
  94.         }
  95.  
  96.         return false;
  97.     }
  98.  
  99.     /**
  100.      * Get the size of directory. If $_fInfoExt is specified, only get size of directory that has what was indicated.
  101.      *
  102.      * @param string $dir Directory name
  103.      * @return integer
  104.      */
  105.     private function _dirSize($dir){
  106.         $size = 0;
  107.  
  108.         foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir)) as $file){
  109.             if($this->_realExtFile(realPath($file->getPathname()), $this->_fInfoExt)){ continue; }
  110.             $size+=$file->getSize();
  111.         }
  112.         return $size;
  113.     }
  114.  
  115.     /**
  116.      * Set array with the structure of directories and files
  117.      *
  118.      * @param string $root
  119.      * @param int $n
  120.      * @return array
  121.      */
  122.     public function setFile($root, $n = 0){
  123.         $onlyDirs = array();
  124.         $onlyFiles = array();
  125.         $n++;
  126.  
  127.         foreach(glob($root . DIRECTORY_SEPARATOR . '*') as $file){
  128.             /**
  129.              * Check if dir is empty, do not display and if is
  130.              */
  131.             if($this->_hideEmptyDir && is_dir($file) && $this->_dirSize($file) == 0){ continue; }
  132.  
  133.             /**
  134.              * Set info of file
  135.              */
  136.             $f = pathInfo($file);
  137.  
  138.             if(is_dir($file)){
  139.                 /**
  140.                  * Check if dir name is only number(s), append a space
  141.                  * to the end of the name to mantain the key when using array_merge.
  142.                  */
  143.                 $key = is_numeric($f['basename'])
  144.                     ? $f['basename'] . ' '
  145.                     : $f['basename'];
  146.                 $onlyDirs[$key] = array(
  147.                                     'real_path' => realpath($f['dirname'] . DIRECTORY_SEPARATOR . $f['basename']),
  148.                                     'n_array' => $n,
  149.                                     'files_in_dir' => $this->setFile($file, $n)
  150.                                 );
  151.             }
  152.             else{
  153.                 $onlyFiles[$f['basename']] = array(
  154.                                                 'real_path' => realpath($f['dirname'] . DIRECTORY_SEPARATOR . $f['basename']),
  155.                                                 'http_path' => '.' . str_replace(array('\\', '//'), '/', str_replace(getcwd(), '', $f['dirname'])) . '/' . $f['basename'],
  156.                                                 'n_array' => $n,
  157.                                                 'pathInfo' => pathInfo($file),
  158.                                                 'timeModified' => date('m-d-Y H:i:s', filemtime($file))
  159.                                             );
  160.             }
  161.         }
  162.         return array_merge($onlyDirs, $onlyFiles);
  163.     }
  164.  
  165.     /**
  166.      * Organize array given of setFile()
  167.      *
  168.      * @param array $files
  169.      * @param string $class Show or hide directory info, values: show|hide Default: show (for firsts directories)
  170.      * @return string
  171.      */
  172.     public function getFile($files, $class='show'){
  173.         $customFile = '';
  174.  
  175.         foreach($files as $key => $file){
  176.             if($this->_realExtFile($file['real_path'], $this->_fInfoExt)){ continue; }
  177.  
  178.             if(is_array($file) && $key != 'pathInfo'){
  179.                 if($key != 'files_in_dir'){
  180.                     /**
  181.                      * Check if is directory or file and if is a file you can add more mime extentions
  182.                      * for more info about mime extention check the method setFInfoExt()
  183.                      */
  184.                     switch($this->_whatMimeExt($file['real_path'])){
  185.                         case 'directory':
  186.                             $img = '<img src="images/dir.png" width="20" height="20" alt="' . trim($key) . '" title="' . trim($key) . '" />';
  187.                             break;
  188.                         case 'application/pdf':
  189.                             $img = '<img src="images/pdf.png" width="20" height="20" alt="' . trim($key) . '" title="' . trim($key) . '" />';
  190.                             break;
  191.                         default:
  192.                             $img = '<img src="images/file.png" width="14" height="20" alt="' . trim($key) . '" title="' . trim($key) . '" />';
  193.                     }
  194.  
  195.                     $tab = str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $file['n_array']);
  196.                     $link = (empty($file['http_path'])
  197.                         ? '<a href="javascript: void(0);" onclick="hideUnhideMenu(this)" >' . $img . trim($key) . '</a>'
  198.                         : '<a href="' . $file['http_path'] . '" target="content" onclick="'
  199.                             . 'hideUnhideExtras(\'tree_notification\');'
  200.                             . ' setTimeout(\'hideUnhideExtras(\\\'tree_notification\\\')\', 1500);'
  201.                             . '">' . $img . ' ' . trim($key) . '</a>'
  202.                     );
  203.                     $customFile .= $tab . ' ' . $link . '<br />';
  204.                 }
  205.                 if(!empty($file['files_in_dir'])){
  206.                     $customFile .=  $this->getFile($file['files_in_dir'], 'hide');
  207.                 }
  208.             }
  209.         }
  210.  
  211.         return '<div class="tree_' . $class . '">' . $customFile . '</div>';
  212.     }
  213. }

style.css
Código CSS:
Ver original
  1. * { padding: 0; margin: 0; }
  2. html, body{ width: 100%; height: 100%; }
  3. body {
  4.     background: #C3C3C3;
  5.     font-family: Arial, Helvetica, sans-serif;
  6.     font-size: 13px;
  7.     color: #666666;
  8. }
  9.  
  10. a{
  11.     color: #369;
  12.     text-decoration: none;
  13.     font-weight: bold;
  14. }
  15. a:hover{ color: #900; }
  16. img{ border: none; }
  17.  
  18. /*tree*/
  19. .tree_hide{ display: none; }
  20. .tree_show{ display: block; }
  21. #tree_notification{
  22.     background-color: #6886ac;
  23.     padding: 4px 5px 5px 5px;
  24.     position: absolute;
  25.     top: 0;
  26.     right: 0;
  27.     color: #fff;
  28.     font-size: 14px;
  29.     display: none;
  30. }

script.js
Código Javascript:
Ver original
  1. function hideUnhideMenu(obj){
  2.     obj = obj.nextSibling;
  3.     while(obj.nodeName != 'DIV'){
  4.         obj = obj.nextSibling
  5.     }
  6.     var thisElement = obj.style;
  7.     if(thisElement.display == 'block'){ thisElement.display = 'none'; }
  8.     else{ thisElement.display = 'block'; }
  9. }
  10.  
  11. function hideUnhideExtras(id){
  12.     var thisElement = document.getElementById(id).style;
  13.     if(thisElement.display == 'block'){ thisElement.display = 'none'; }
  14.     else{ thisElement.display = 'block'; }
  15. }

blank.php o blank.html es un archivo vacio, para evitar errores en los frames. Crean un directorio llamado images y colocan las siguientes imagenes

dir.png
pdf.png
file.png

Edito: Necesitan tener activa la extensión php_fileinfo

Nota:
12-24-2010 - se añadió la variable $safe_mode, sugerida por miktrv.
12-28-2010 - se cambió el nombre de la variable $safe_mode a $_safeMode y se creó la variable $_hideEmptyDir. Se modificó el código para que en el construct se indicara las extensiones a mostrar
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos

Última edición por abimaelrc; 28/12/2010 a las 06:26
  #4 (permalink)  
Antiguo 24/12/2010, 12:09
 
Fecha de Ingreso: abril-2003
Ubicación: Mexico
Mensajes: 604
Antigüedad: 21 años
Puntos: 23
Respuesta: [APORTE] Crear árbol de directorios

buenas!!

pues no se a los demas pero esta modificacion simplemente no me funciona :S

marca error de directorio

Fatal error: Call to undefined function finfo_open() in C:\www\giina\test\directorios\class.php on line 45

checando la linea es esta

$fInfo = finfo_open(FILEINFO_MIME_TYPE);

asi que.. pense que era que no tenia especificado directorio pero no veo donde configurar el directorio

saludos!!
__________________
¡El Respeto al Derecho Ajeno Es la Paz!
  #5 (permalink)  
Antiguo 24/12/2010, 12:23
 
Fecha de Ingreso: julio-2008
Ubicación: Barcelona
Mensajes: 2.100
Antigüedad: 15 años, 9 meses
Puntos: 165
Respuesta: [APORTE] Crear árbol de directorios

Código PHP:
function listar_directorios_ruta($ruta){ 
   if (
is_dir($ruta)) { 
      if (
$dh opendir($ruta)) { 
         while ((
$file readdir($dh)) !== false) { 
            
//echo "<br>Nombre de archivo: $file : Es un: " . filetype($ruta . $file); 
            
if (is_dir($ruta $file) && $file!="." && $file!=".."){ 
               
//solo si el archivo es un directorio, distinto que "." y ".." 
               
echo "<br>Directorio: $ruta$file"
               
listar_directorios_ruta($ruta $file "/"); 
            } 
         } 
      
closedir($dh); 
      } 
   }else 
      echo 
"<br>No es ruta valida"

Esta función de desarrolloweb esta mas simple, puedes saber si es un directorio o no con el is_dir...

Un saludo!
  #6 (permalink)  
Antiguo 24/12/2010, 12:41
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 11 meses
Puntos: 1517
Respuesta: [APORTE] Crear árbol de directorios

Cita:
Iniciado por HalconVigia Ver Mensaje
buenas!!

pues no se a los demas pero esta modificacion simplemente no me funciona :S

marca error de directorio

Fatal error: Call to undefined function finfo_open() in C:\www\giina\test\directorios\class.php on line 45

checando la linea es esta

$fInfo = finfo_open(FILEINFO_MIME_TYPE);

asi que.. pense que era que no tenia especificado directorio pero no veo donde configurar el directorio

saludos!!
Se me olvidaba indicar que tienen que activar la extensión php_fileinfo

Cita:
Iniciado por miktrv Ver Mensaje
Código PHP:
function listar_directorios_ruta($ruta){ 
   if (
is_dir($ruta)) { 
      if (
$dh opendir($ruta)) { 
         while ((
$file readdir($dh)) !== false) { 
            
//echo "<br>Nombre de archivo: $file : Es un: " . filetype($ruta . $file); 
            
if (is_dir($ruta $file) && $file!="." && $file!=".."){ 
               
//solo si el archivo es un directorio, distinto que "." y ".." 
               
echo "<br>Directorio: $ruta$file"
               
listar_directorios_ruta($ruta $file "/"); 
            } 
         } 
      
closedir($dh); 
      } 
   }else 
      echo 
"<br>No es ruta valida"

Esta función de desarrolloweb esta mas simple, puedes saber si es un directorio o no con el is_dir...

Un saludo!

Claro, solo lista la ruta completa y aún se puede hacer más pequeña esa función con glob, algo así
Código PHP:
Ver original
  1. <?php
  2. function listar_directorios_ruta($ruta){
  3.     foreach(glob($ruta . '/*') as $v){
  4.         if(is_dir($v)){
  5.             listar_directorios_ruta($v);
  6.         }
  7.         echo $v . '<br />';
  8.     }
  9. }
  10. listar_directorios_ruta('ruta/del/directorio/a/leer');
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos
  #7 (permalink)  
Antiguo 24/12/2010, 12:45
 
Fecha de Ingreso: julio-2008
Ubicación: Barcelona
Mensajes: 2.100
Antigüedad: 15 años, 9 meses
Puntos: 165
Respuesta: [APORTE] Crear árbol de directorios

Y no hace falta usar el close?

Un saludo!
  #8 (permalink)  
Antiguo 24/12/2010, 12:46
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 11 meses
Puntos: 1517
Respuesta: [APORTE] Crear árbol de directorios

Cita:
Iniciado por miktrv Ver Mensaje
Y no hace falta usar el close?

Un saludo!
No.

Edito: La idea de ese código es listar los directorios como un árbol, con tabulaciones y al pulsar el directorio se esconde el contenido que tenga dentro de él.
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos
  #9 (permalink)  
Antiguo 24/12/2010, 12:54
 
Fecha de Ingreso: julio-2008
Ubicación: Barcelona
Mensajes: 2.100
Antigüedad: 15 años, 9 meses
Puntos: 165
Respuesta: [APORTE] Crear árbol de directorios

Sí, yo lo abro cuando se pulsa sobre él, de tal manera que no hace falta listarlo entero, prefiero ir "abriendo sobre la marcha", ya que si tengo algo enorme tardaría mucho en hacerlo, no?

Un saludo!
  #10 (permalink)  
Antiguo 24/12/2010, 12:57
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 11 meses
Puntos: 1517
Respuesta: [APORTE] Crear árbol de directorios

Perdona no entendí a lo que te refieres. Podrías explicar mejor.
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos
  #11 (permalink)  
Antiguo 24/12/2010, 13:00
 
Fecha de Ingreso: julio-2008
Ubicación: Barcelona
Mensajes: 2.100
Antigüedad: 15 años, 9 meses
Puntos: 165
Respuesta: [APORTE] Crear árbol de directorios

Pues, lo que yo hacía, era listar el directorio principal, después con is_dir, comprobaba si era un directorio, si lo era, aplicaba un <a href con la ruta de ese directorio, que la pasaba por get, de esa manera, de forma dinámica abria el directorio sobre el cual se pulsaba (no sin antes comprobar que existía y que no se intentaba pasar algo como ../ )

Un saludo!
  #12 (permalink)  
Antiguo 24/12/2010, 13:03
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 11 meses
Puntos: 1517
Respuesta: [APORTE] Crear árbol de directorios

Trata el código que postee para que veas como funciona, y haz diferentes pruebas, si encuentras algún fallo me dejas saber. Ahora, si usan ../ va a ir al directorio anterior, eso no lo evité porque el código lo que va a hacer es solamente seguir las instrucciones del que lo usa y si la persona quiere listar el directorio anterior lo podrá hacer, solo que si tiene muchos archivos se va a congelar la maquina por un tiempo hasta que pueda listar todos los directorios o posiblemente no publicar nada porque se congeló por completo.
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos
  #13 (permalink)  
Antiguo 24/12/2010, 13:10
 
Fecha de Ingreso: julio-2008
Ubicación: Barcelona
Mensajes: 2.100
Antigüedad: 15 años, 9 meses
Puntos: 165
Respuesta: [APORTE] Crear árbol de directorios

Claro...

Estaría bien colocar algo del tipo... safe_mode = true.. para que no puedan navegar hacia detrás, o indicar la ruta inicial, así, si esta por detrás de la ruta inicial no le dejas.. no sé, sólo son ideas...

con el código que yo te digo, también se congelaría si abro un directorio enorme... pero siempre hay menos posibilidades de que eso pase, no?

Un saludo!
  #14 (permalink)  
Antiguo 24/12/2010, 13:22
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 11 meses
Puntos: 1517
Respuesta: [APORTE] Crear árbol de directorios

Interesante, lo creo y dejo saber
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos
  #15 (permalink)  
Antiguo 24/12/2010, 13:24
 
Fecha de Ingreso: julio-2008
Ubicación: Barcelona
Mensajes: 2.100
Antigüedad: 15 años, 9 meses
Puntos: 165
Respuesta: [APORTE] Crear árbol de directorios

De acuerdo!!


Un saludo!! me alegro de haber aportado algo más a tu código!
  #16 (permalink)  
Antiguo 24/12/2010, 13:34
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 11 meses
Puntos: 1517
Respuesta: [APORTE] Crear árbol de directorios

Ya está añadido http://www.forosdelweb.com/3683170-post3.html, gracias
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos
  #17 (permalink)  
Antiguo 24/12/2010, 13:41
 
Fecha de Ingreso: julio-2008
Ubicación: Barcelona
Mensajes: 2.100
Antigüedad: 15 años, 9 meses
Puntos: 165
Respuesta: [APORTE] Crear árbol de directorios

Muy bien!


Un saludo!!

Etiquetas: directorios, aportes
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:14.