CSS

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentCSS

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old May 24th, 2009, 03:03 PM
peuplarchie peuplarchie is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 2 peuplarchie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 59 sec
Reputation Power: 0
Post Vertical line in tree menu ?

Good day to you all,
I'm working on a directory listing in php and I want to display the result as a directory tree.

Pretty much everything is done except for the icon part.
What I would like is to have the little vertical line beside the icon which would help understanding the menu and his hierarchy.

I was wondering if there is a way of doing those line with css instead of image based ?

Here is my code :


Code:



// Error report put at report all
error_reporting(E_ALL);


ini_set("display_errors", "on");
        
set_time_limit(0);
        
//Put as variable the directory i start from
$dir = "Trips/";

// The dirlist function declarations
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);
        
            global $dir;
            $topLevel = ($directory == $dir) ? true : false;
            $colors = array("#DB1212", "#00300", "#000000");
            if (time() - filemtime($directory.$file) < 604800) { 
// If file is younger than a month, write in red 
            $color = $colors[0];
    
} elseif (time() - filemtime($directory.$file) < 31556926) { 
// If file is older than a month but younger than a year, write in green 
            $color = $colors[1];
    
    // file, folder, older than a year, write it in black
} else {
            $color = $colors[2];
}
 
       if($topLevel){
    $folder_modified[] = "<br/><li id=\"folder\"><strong style=\"color:$color;\">".$file."</strong></a>";
        }else{
    $folder_modified[] = "<li id=\"folder\"><a href=\"index.html\" onclick=\"load('folder_view.php?dir=".$directory."".$file."','boxdisp');return false;\" style=\"color:$color;\">".$file."</a>";
        }
// Here I would list the files too but I don't need it for this site.
        // Else not styled
        }else{
        array_push($files,$file);
     $filenamecor = substr($file, 0, -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>';}
 // write nothing cause I don't need the files to be listed .
 
    }
    }


//declaring the variable that the result will be put in.
$output = "";
// starting the list by 
    $output .= "<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) {
        
      $output .= "".$folder_modified[$folder]; //echo the folder name enclosed in a list item
      $output .=   dirList($directory.$file.'/'); //loop through the contents of $folder
      $output .= "\n"; //close this list item after all files and folders in $folder have been looped through
   
   
    }
 
    foreach($files as $key=>$file) {

    }
 
 
    $output .= "</ul>\n"; //close the unordered list

      return $output;

echo $output;

    }




Thanks !

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentCSS > Vertical line in tree menu ?


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap