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.
-
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.