Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Greetings Monks,
I've ran into a small situation and here I am to seek the help of you esteemed.

This is the requirement - to emulate a windows-explorer like directory tree structure (using perl, ofcourse)
Oh, and the directories that we're talking of is from a linux box.
So, considering I have a recursive directory listing in the form like this:
examples/html: examples/html/bars: examples/html/headers: examples/html/links: examples/html/lists: examples/html/menus: examples/html/rgb: examples/html/tables: examples/ps: examples/ps/marks: examples/splash: examples/splash/dropbox: examples/splash/frame: examples/splash/hair: examples/splash/icon: examples/splash/menu: examples/splash/menubar:
..the output that is required is a kind like this:
<ul> <li><a href="examples/">examples/</a> <ul> <li><a href="examples/html">html/</a> <ul> <li><a href="examples/html/bars/">bars</a></li> <li><a href="examples/html/headers/">headers</a></li> <li><a href="examples/html/links/">links</a></li> <li><a href="examples/html/lists/">lists</a></li> <li><a href="examples/html/menus/">menus</a></li> <li><a href="examples/html/rgb/">rgb</a></li> <li><a href="examples/html/tables/">tables</a></li> + </ul> </li> <li><a href="examples/ps/"">ps/</a> <ul> <li><a href="examples/ps/marks">marks</a></li> </ul> </li> <li><a href="examples/splash/">splash/</a> <ul> <li><a href="examples/splash/dropbox/">dropbox</a></li +> <li><a href="examples/splash/frame/">frame</a></li> <li><a href="examples/splash/hair/">hair</a></li> <li><a href="examples/splash/icon/">icon</a></li> <li><a href="examples/splash/menu/">menu</a></li> <li><a href="examples/splash/menubar/">menubar</a></li +> </ul> </li> </ul> </li> </ul>

The Unordered-List will then be used along with a JavaScript code and a Style Sheet making it a tree-like expandable struture.
I'm finding the making of the unordered list a bit complicated - from the raw data. (Array of arrays, multiple arrays etc.)
And this is only the directories and we aren't listing any files at all.

Any help is appreciated.

Thanks,
Rupesh.

In reply to Directory Tree Structure by rupesh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-16 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found