Output format

149 views
Skip to first unread message

Kaleb C

unread,
Apr 13, 2011, 3:08:56 PM4/13/11
to dirhtml discussion group
Is it possible to make dirhtml output like a normal directory layout?
(eg. the Root table has the links to the subfolders and files in the
root folder. each of the subfolders' tables have links to the
subfolders and files within them etc.)

┌────────────┐
│ Root │
├──────┬──┬──┤
│subfolder │file │file │
└──────┴──┴──┘

┌───────────────────┐
│ subfolder │
├───────┬───────┬───┤
│subfolder2 │ subfolder3 │file │
└───────┴───────┴───┘

┌────────────────┐
│ subfolder2 │
├──┬──┬───┬───┬──┤
│file │file │file │file │file│
└──┴──┴───┴───┴──┘

┌────────────────┐
│ subfolder3 │
├──┬──┬───┬───┬──┤
│file │file │file │file │file│
└──┴──┴───┴───┴──┘

subfolder, subfolder2, subfolder3, and file are links.

Thanks,
Kaleb C

dirhtml

unread,
Apr 13, 2011, 3:44:17 PM4/13/11
to dirhtml discussion group
With some limits, yes. Dirhtml can only generate tables that are
twenty links wide, so any subfolders with more than twenty files would
wrap to a new table row.

To make the sub-folder sections clickable, it would require a special
script. It would also require implementation of %%F or %
%RELATIVE_PATH in anchors, which is currently not implemented, but
could be easily done.

I don't have time to test it right now, but a script would need to
incorporate something like this:

/ANCHOR
&nbsp;&nbsp;<a href="%%F">FOLDER LINK</a>

Kaleb C

unread,
Apr 13, 2011, 5:22:36 PM4/13/11
to dirhtml discussion group
but, is there a way to make the subfolders listed under the parent
folder table? So I can navigate like I would in Windows Explorer,
start in the root, click a link to a subfolder, which sends me to a
table for that subfolder. there I could click a link to a file or
click a link to one of its subfolders, etc.

Instead of having an Anchor table at the top with all the folder
links, I want to have the folder links incorporated into the table. So
if I want to get to a file at D:\Projects\Website\images\bg.jpg I
could start at the root folder table:
click the link for the projects folder, which would send me to the
Projects folder table
there I could click a link to the Website folder which would send me
to the Website folder table
there I could click a link to the images folder which would send me to
the images folder table
where I could click a link to bg.jpg.

http://dl.dropbox.com/u/26183417/Example.html
(This is an example html showing what I mean.)

dirhtml

unread,
Apr 13, 2011, 5:58:51 PM4/13/11
to dirhtml discussion group
Yes, take a look at some of the examples on the dirhtml web page:
http://dirhtml.home.comcast.net/~dirhtml/

On the "Recursive" page:
* select "Build file(s) recursively"
* un-select "Create an anchor table"
* select "show sorted folders as <tr>'s"

Enabling clickable folders inside the file table will be in the next
version of dirhtml.

Kaleb C

unread,
Apr 13, 2011, 6:50:54 PM4/13/11
to dirhtml discussion group
Okay, thank you. The clickable folders were what I was trying to ask
about but couldn't figure out how to word it. I built a rather large
html and the anchor table was huge, so it would be easier for the
folder links to be inside the file table. I am glad you are
implementing that. Your program is very useful and I appreciate the
help.

Thanks,
Kaleb C

PS: I'm just curious, what language do you use to make dirhtml?

dirhtml

unread,
Apr 13, 2011, 6:53:13 PM4/13/11
to dirhtml discussion group
Dirhtml is written in MFC/C++, though the html generation code is
generic C++.

dirhtml

unread,
Apr 15, 2011, 3:39:24 PM4/15/11
to dirhtml discussion group
It's worth noting that the size of the anchor table can be minimized
by selecting a "Max Anchor Depth" on the Recusive page.

Kaleb C

unread,
Apr 15, 2011, 4:44:00 PM4/15/11
to dirhtml discussion group
Ok, I am a college student learning C++, so that's why I was curious
whether that is what you used.

I didn't notice the Max Anchor Depth. Does each folders file table
have a unique 'ID'? I was going to include some javascript in the Head
and need to put some code before the declaration of the file table for
each folder, which would need a variable to reference the table that
it is before.

This goes in the head:
<script type="text/javascript">
function toggleMe(a){
var e=document.getElementById(a);
if(!e)return true;
if(e.style.display=="none"){
e.style.display="block"
}
else{
e.style.display="none"
}
return true;
}
</script>


And this would go before the folder declaration:
<input onclick="return toggleMe('FolderID')" value="Show/Hide"
type="button">

FolderID needs to be a variable for a file table. This would make a
button that would expand/collapse the file table for each folder.

Thanks,
Kaleb C.

dirhtml

unread,
Apr 15, 2011, 4:49:48 PM4/15/11
to dirhtml discussion group
Yes, each #folder in a file table has a unique ID. It's basically a
formatted version of the folder + '-'.

What you asking is very difficult or impossible to do with table
rows. I am aware it's pretty easy with css lists.

dirhtml

unread,
Apr 15, 2011, 5:17:59 PM4/15/11
to dirhtml discussion group
At the moment you consider javascript controlled lists, you give up
entirely the stretchable nature of tables and cells.

Dirhtml is about static data.

Kaleb C

unread,
Apr 17, 2011, 5:20:58 PM4/17/11
to dirhtml discussion group
Oh, okay. I am still at beginner level with HTML, CSS, and Javascript.
I am trying to teach myself and I had used that to show/hide a flash
application on the website I am messing around with and just blindly
assumed it would work for anything with an ID. I was just trying to
come up with a temporary solution to the clickable folders thing.

Thanks again,
Kaleb C.
Reply all
Reply to author
Forward
0 new messages