Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post

    Post Send function result to html page ?

    Good day to you,
    here i'm listing files and send the result into a html file.

    My problem,
    the result don,t seems to be written in the html file.
    Don't give me any error, just a black page.

    here is my code :
    PHP Code:


    <?php
             set_time_limit
    (90);
    $directory "Art/";
    function 
    dirList ($directory)
    {
     
        
    //create 2 arrays - one for folders and one for files
       
    $folders = array();
       
    $files = array();
     
        
    // create a handler for the directory
        
    $handler opendir($directory);
     
        
    // keep going until all files in directory have been read
    while (false !== ($file readdir($handler))) {  
     
            
    // if $file isn't this directory or its parent,
            // add it to the results array
            
    if ($file != '.' && $file != '..')
           
            
    // If file is directory, mark it in bold.

           
    if(is_dir($directory.$file)) {
            
    array_push($folders,$file);
            
                if (
    time() - filemtime($directory.$file) < 604800) {
        
    $folder_modified[] = "<span style=\"color:#DB1212;\"><li><div class=\"folder\"><img src=\"plus_icon.gif\"  onclick=\"Toggle('".preg_replace('/\//','_',$directory."".$file)."'); return false;\" /><b>".$file."</b></div>";
    } elseif (
    time() - filemtime($directory.$file) < 31556926) {
        
    $folder_modified[] = "<span style=\"color:#003366;\"><li><div class=\"folder\"><img src=\"plus_icon.gif\"  onclick=\"Toggle('".preg_replace('/\//','_',$directory."".$file)."'); return false;\" /><b>".$file."</b></div>";
    } else {
    $folder_modified[] = "<span style=\"color:#000000;\"><li><div class=\"folder\"><img src=\"plus_icon.gif\"  onclick=\"Toggle('".preg_replace('/\//','_',$directory."".$file)."'); return false;\" /><b>".$file."</b></div>";}
     
            
           
            
    // Else not styled
            
    }else{
            
    array_push($files,$file);
         
    $filenamecor substr($file0, -4);
        if (
    time() - filemtime($directory.$file) < 604800) {
        
    $file_modified[] = '<span style="color:#DB1212;">'.$filenamecor.'<span>';
    } elseif (
    time() - filemtime($directory.$file) < 31556926) {
        
    $file_modified[] = '<span style="color:#003366;">'.$filenamecor.'<span>';
    } else {
    $file_modified[] = '<span style="color:#000000;">'.$filenamecor.'<span>';}
     
     
        }
        }
     
        echo 
    "<ul id=\"".preg_replace('/\//','_',substr($directory,0,strlen($directory)-1))."\">\n"//start a new unordered list for every iteration through dirList
     
    $dircor $directory;
        
    // tidy up: close the handler
        
    closedir($handler);
        foreach(
    $folders as $folder=>$file) {
            
          echo 
    "<li><div class=\"folder\">".$folder_modified[$folder]."</div>"//echo the folder name enclosed in a list item
            
    dirList($directory.$file.'/'); //loop through the contents of $folder
          
    echo "</li>\n"//close this list item after all files and folders in $folder have been looped through
       
       
        
    }
     
        foreach(
    $files as $key=>$file) {

          echo 
    "<li><a href=\"index.html\" onclick=\"load('image_view.php?dir=".$dircor."&file=".$file."','boxdisp');return false;\">&nbsp;".$file_modified[$key]."</a></li>\n"//echo the file name enclosed in a list item
        
    }
     
     
        echo 
    "</ul>\n"//close the unordered list
    }
     




    $filess=fopen(”menu.txt”,”w”) or die(”myfile.txt does not exist!);

    fwrite($filessdirList($directory));


    fclose($filess);

     
    ?>
    Thanks !

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Have you tried turning error reporting to full?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •