Click to See Complete Forum and Search --> : directory content


rvamerongen
01-26-2003, 01:07 PM
Hello

I need the directory structure at the same level as the index.html. It has to work at the client side. First of cource I was thinking about reading this from the server side, and also of course, no way.

What I want now is to read the folder with someting like
'var url = window.location.protocol + "//" + path;
document.writeln(url);'


I look for someting that I can
1. put the result from document.writeln(url); into a array or object
or
2. put the result into doc in a frame with size 0.then read the doc's content and put it then into a array.
or
3. someone a better idea?

thanks

René

Doug Calli
03-03-2003, 04:41 PM
Dave,

I could use the same thing, I think.
I have a page (and subsequent directories below it) that my client posts changing documents for their clients.
What I need is a variation on the old index.html, where the visitor sees an updated list of files and folders.

If the cost isn't too much, I'd appreciate the help!

Thanks, DC

Doug Calli
03-04-2003, 11:00 AM
Hi Dave,

Re: Your example. Yes, that's (more than) what I'm looking for. For this page I only need an alphabetical listing of files and folders under a specific directory and ideally be able to use it within a framed page but not a neccessity.

This site is on Earthlink. Yes they do allow server side includes and cgi, although you have to let them look at your cgi code first before they set is as executable (I've been through this before with them). I'm not sure about asp but I suspect it's okay, I'll check.
My world of coding for the last 30 yr's has been in embedded procesors (assembly and C++) but I have some experience with Java, CGI and HTML, at least enough knowledge and big heavy books to plunder my way through most problems or squash them with my books! ;-)

Right now I'm using this piece of code, between the HEAD tags,....(Original: Dan Worsham, tweaked by me)
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var myloc = window.location.href;
var locarray = myloc.split("/");
delete locarray[(locarray.length-1)];
var arraytext = locarray.join("/");
// End -->
</script>

between the body tags,.....
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
window.location=arraytext
// End -->
</script>

Unfortunately I have no control over the font size or anything else, so this format is not the solution but it does do the basic idea of letting my clients upload new files and thier clients being able to see the new content.

Thanks, DC

pyro
03-04-2003, 11:31 AM
Originally posted by Doug Calli
I'm not sure about asp but I suspect it's okay, I'll checkIf you find that ASP is not an option, check on PHP. You can see an example of PHP in action at http://www.infinitypages.com/research

Doug Calli
03-04-2003, 12:11 PM
I'll check on that as well.

Thanks, DC

Doug Calli
03-04-2003, 12:38 PM
Earthlink does not support asp but does support php using .php4 as the extension.

pyro
03-04-2003, 07:20 PM
Would you like the PHP script?

Doug Calli
03-05-2003, 12:25 AM
Yes I would!

pyro
03-05-2003, 07:47 AM
Ok, then. Here it is....

Doug Calli
03-05-2003, 10:11 AM
Pyro,

It's perfect, Thanks very much!:D

I guess it's time to learn php, have any suggestions on literature?

Thanks again, DC

pyro
03-05-2003, 10:19 AM
http://www.php.net is a great place to learn
http://www.phpbuilder.com/board is a great PHP forums

Also, the book PHP for the World Wide Web by Larry Ullman seems ok (not great, but not too bad)

Doug Calli
03-05-2003, 10:38 AM
Great, I'll check them out.

BTW
The links to the individual files aren't working right now, they seem to be doubled/repeated. This is how the links are pointing,...
http://www.domain.com/dir1/dir2//www.htdocs/domains/s4/00662/domain.com/webdocs/dir1/dir2 <- dir2 is trunkated


Any ideas?

pyro
03-05-2003, 10:44 AM
Give me a link to the page that has the problem so I can see it, please.

Doug Calli
03-05-2003, 10:45 AM
http://www.jemfx.com/SPFX_Equipment/directory-test/directory-test.php4

pyro
03-05-2003, 10:51 AM
The link you gave is asking for a password, but I found the problem anyway. Line 78 used to be:

$n_url = urlencode("$folder/$array[$i]");

it should be

$n_url = urlencode("$array[$i]");

This code was adapted from a file viewer that I used to view my entire site, so the $folder variable is irrelavent when used on a single directory....

Doug Calli
03-05-2003, 11:01 AM
That did it!

If you'd like to check it, use this PW

DGreene : mojo1

Sorry I forgot I had this test page setup this way.

Thanks again

pyro
03-05-2003, 11:10 AM
The only thing is that you will either want to make some images, or remove the <img> tags. Right now, it is just shows broken images... ;)

Doug Calli
03-05-2003, 11:22 AM
Yes, indeed.
I also need to dress it up a little with the company logo and add a few links to thier site.
I'll probably go ahead now and setup the actual directory and let the client start loading it but I'll leave this page up for a while for others (like me) to see the results.

BTW: Did you see the Co. logo?
Are you related? :p

DC

pyro
03-05-2003, 11:30 AM
No, I didn't see the logo. Where is it?

One other thing for you to note: you can easily add support for file types other than PHP or HTML...Check the comments in the script.

Doug Calli
03-05-2003, 11:38 AM
Yes I did see them and appreciate the comments in the code. I'll be updating that as well. I've got a few plates spinning right now, so it's a little here, a little,...

the home page/logo,...
http://www.jemfx.com

You'll see what I meant,

pyro
03-05-2003, 11:46 AM
...lol. Nope never heard of it before. :D

Doug Calli
03-05-2003, 11:54 AM
I thought you would appreciate that. :)

Doug Calli
03-06-2003, 10:53 AM
Hi Pyro,

I sent an email to you through your site to the sales address.