View previous topic :: View next topic |
Author |
Message |
rikardos -
Joined: 18 Jan 2007 Posts: 3
|
Posted: Thu Jan 18, 2007 8:50 pm Post subject: Search Function? |
|
|
Is there any way i can add a seach function for my server?
I want to be able to seach certain folders, on my server i got /index/Music
and /index/Movies and they got sevral subfolders and i want to be able to seach all subfolders in the certain folder
Like:
If you are in /index/music you can only seach that folder and subfolders
and if you are in /index/movies you can only seach that folder and subfolder
and i dont really want to change the style on my directory listing |
|
Back to top |
|
|
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Thu Jan 18, 2007 10:09 pm Post subject: |
|
|
You could use scandir() in PHP. It however requires some PHP skills.
Here's a simple example code:
(Should work, didn't test it tough)
Code: | <?php
$files = scandir("/var/www/index/music");
$search = "iron maiden";
foreach ($files as $n => $file) {
if (eregi($search, $file)) {
echo "$n. $file<br />";
}
}
?> |
You'll have to use is_dir() if you want to include subdirs. |
|
Back to top |
|
|
rikardos -
Joined: 18 Jan 2007 Posts: 3
|
Posted: Thu Jan 18, 2007 11:09 pm Post subject: |
|
|
well.. i got no PHP skill , maby i can ask my brother, hes a programer and might be able to help me.
And maby someone got an easier and understandable finished script or something.
I managed to modify my directory listing to my likeing , so if someone got something complete i migt be able to modify it. |
|
Back to top |
|
|
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Thu Jan 18, 2007 11:50 pm Post subject: |
|
|
I suggest you do a google search and look for some basic PHP tutorials. Once you know the basics of PHP you can learn other functions etc as you go along, just as I am.
I have a fairly intermediate knowledge in PHP after using it for a few years. Some people will pick it up quicker then others however. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
|
rikardos -
Joined: 18 Jan 2007 Posts: 3
|
Posted: Fri Jan 19, 2007 1:28 am Post subject: |
|
|
I just found out that my directory listing using javascript, can i use php with javascript?
Is there a way to add a seach to that?
Is there way to make a database of all the files that the directory listing using in the certain main folders and subfolders and make it seachable?
the Abyss config got all the directorys aliases listed and some script might be able to create a seachable database that can link it to the files place on the server or at least show were it is listed.
I really like the directory listing im using and javascrip seems easier than PHP, just looking at the javascrip code and i could cuztomize the directory listing to my likeing, and i dont really want to swith it to something else.
i can post the code if i will help.
And i really like the Abyss Web Server, its easy to use and i can run it on my everyday comp ,i even liked it so much i made a nicer picture of the "Powered By Abyss Web Server" pic, and i wonder what everyone thinks(wrong category maby).... Large..Small, Use em if you want |
|
Back to top |
|
|
|