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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.