Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Directory Files Displaying


5 replies to this topic

#1 itssami

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 258 posts

Posted 13 May 2006 - 07:08 PM

I have many files in a directory..I want to create a page , like
A B C D E F .....
when some one click on A , it should display all the files starting from letter A , and when clicks on B , it should show all the files in that directory starting from B , and so on... I have no idea how to display the files of the directory iin that way.
Kindly assist me..

#2 farsiscript

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 357 posts
  • Interests:... No More !

Posted 14 May 2006 - 01:30 PM

You can make That with SQL database and files url
You can make one page with search query with "a" or "b" or "c" or ....."z"
when your users click at "a" your php code must go and file A files in database and sort it for your user .
or You can make these files with statics search guery
a.php , b.php , c.php , d.php , e.php ,
When Your user click at "A" You must link at a.php

Edited by farsiscript, 14 May 2006 - 01:32 PM.


#3 jlhaslip

    Insert Custom Title Here

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,040 posts
  • Gender:Not Telling
  • Location:Linux, DOS and Windows…the good, the bad and the ugly
  • myCENT:81.07
  • Spam Patrol

Posted 14 May 2006 - 02:56 PM

Ittsami,
My suggestion would be to:
Begin by building an array of the letters of the alphabet (a-z) and producing the list of links that would select the letter. (maybe a pull-down listbox?)
Then use that letter as a search/sort criteria of the directory list. Write the file names into another array, then sort the array, then echo the list using a function similar to the one which you have been earlier provided with to list file names from a directory, except this time, use the array of filenames as the function source rather than the directory contents.
A Database would not be required if there were only a small list of files, but it would be faster to use the Database approach as suggested above if there were lots of files in the Directory.

#4 Inspiron

    Trap Grand Marshal Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,204 posts

Posted 14 May 2006 - 04:25 PM

It's done... I've sent the files to you.. Check out for bugs and let me know.. :)

Also, with regards to the replies above, I would like to point that there isn't a need to use a database. In fact, having a database isn't efficient when there is a whole lot of files added to the directory, and you will have to update the database. If a hundred connections are accessing the directory, the database will have to undergo maintanence very often when each connection changes the directory structure. In fact, I've remade a script done by itssami to use only itself, 1 file, to handle the directory structure without the need of using a database or a requirement of a 2nd php file. This way, it's alot more easier for debugging and administrating his web site.

Edited by Inspiron, 14 May 2006 - 04:35 PM.


#5 jlhaslip

    Insert Custom Title Here

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,040 posts
  • Gender:Not Telling
  • Location:Linux, DOS and Windows…the good, the bad and the ugly
  • myCENT:81.07
  • Spam Patrol

Posted 14 May 2006 - 04:38 PM

So could you post the code here so we can all benefit?

#6 Inspiron

    Trap Grand Marshal Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,204 posts

Posted 14 May 2006 - 04:44 PM

View Postjlhaslip, on May 15 2006, 12:38 AM, said:

So could you post the code here so we can all benefit?
I'll leave it to itssami to decide if he want's to release the source codes..




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users