![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Sep 2008
Posts: 4
OS: Ubuntu HardyHeron / XP SP3
|
Hi all
First post so here goes...been an avid reader for a while but the time has come..... ![]() I am trying to set up a simple intranet site for my work and would like a bit of help with something which will make my life MUCH easier in the future. The intranet site will only be used within my department to access help docs, .pdf/.doc etc. At the moment there are 200+ files in different folders and this will increase in the future. What I would like to have is a script or similar that will add the filename as a link in to the intranet webpage where the file is placed. So for instance, I add a new pdf document called 'New User Setup.pdf' to a folder called 'User Setup' within the web folders and it would automatically (somehow.....using a periodically run script or db!!) create a link to that file on the user_setup.html/.php/.asp page. At the moment I have not decided on the format i.e. php etc so open to suggestions. The simplar the better, however what I want may not be that simple!! I have dealt with php/html & asp previously, also MySQL & M$ SQL. Any ideas would be great....well, apart from "add all in manually including future ones" heheThanks in advance. |
|
|
|
|
|
#2 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Northampton, UK
Posts: 1,090
OS: Win Vista Home Premium & Ubuntu Hardy(8.04)
|
Re: Webpage that automatically adds new filenames
Hey, this would be easy to do using PHP, rather than updating the list automatically you could get a list of all the files under the directory when the user requests the page...
e.g. have a listFiles.php file(or whatever name) and load it as the main page/a page when the user logs in... useful functions for this would be: glob() - http://www.w3schools.com/PHP/func_filesystem_glob.asp is_dir() - http://www.w3schools.com/PHP/func_filesystem_is_dir.asp is_file() - http://www.w3schools.com/PHP/func_fi...em_is_file.asp Using these three functions you could list the files in a certain directory when the page loads(hence no need to update a list). Cheers, Jamey |
|
|
|
|
|
#3 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Northampton, UK
Posts: 1,090
OS: Win Vista Home Premium & Ubuntu Hardy(8.04)
|
Re: Webpage that automatically adds new filenames
oh, p.s. i could try writing some basic code for you in php if you'd like but as long as you have basic experience of PHP this should be fine.
|
|
|
|
|
|
#4 (permalink) |
|
Registered User
Join Date: Sep 2008
Posts: 4
OS: Ubuntu HardyHeron / XP SP3
|
Re: Webpage that automatically adds new filenames
Thank you for the quick reply.
My php is not great!! Had a look at the links you have added and can't understand how it would create the links to the files. I understand that its pulling the list but not the linking. A bit of coding would be a bloody great help if that's OK? ![]() |
|
|
|
|
|
#5 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Northampton, UK
Posts: 1,090
OS: Win Vista Home Premium & Ubuntu Hardy(8.04)
|
Re: Webpage that automatically adds new filenames
Okay, if i were doing this i'd do something like:
PHP Code:
Cheers, Jamey =] |
|
|
|
|
|
#7 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Northampton, UK
Posts: 1,090
OS: Win Vista Home Premium & Ubuntu Hardy(8.04)
|
Re: Webpage that automatically adds new filenames
I gave it a try on my own testing server and it works as i'd expected... =] Glad to be of help.
Cheers, Jamey |
|
|
|
|
|
#8 (permalink) |
|
Registered User
Join Date: Sep 2008
Posts: 4
OS: Ubuntu HardyHeron / XP SP3
|
Re: Webpage that automatically adds new filenames
Hi
Thanks for the code....worked as you said...again thanks!! Is there any way of getting the code to put the produced files in alphabetical order? Also, can you steer me in the direction of how to tidy it up a bit, I would like to wrap a font around it and also a link colour but when I do it on either side of the code it messes up!! Cheers!! |
|
|
|
|
|
#9 (permalink) |
|
Design Team Member
Join Date: Oct 2006
Location: Richmond, B.C.; Canada
Posts: 666
OS: Windows XP [Version 5.1.2600] SP3 | Ubuntu Hardy Heron
|
Re: Webpage that automatically adds new filenames
You could use CSS to efficiently and elegantly avoid that problem.
<html> <head> <style type="text/css"> a .file {color: "hexadecimal_value_of_colour"; font-family: "font"} */other CSS data*/ </style> </head> </body> <!--data--> echo "<a class="file" href='$file'>$file</a><br>\n"; </body> </html> "hexadecimal_value_of_colour": the hexadecimal value of the colour you have chosen. Each colour displayable by the browser has been assigned a particular alpha-numeric hexidecimal value, based on the hue, shade, and brightness of the colour. For example, the red I used to highlight the "class=file" is #ff0000. For more information on hexadecimal colour values, please read http://www.w3schools.com/Html/html_colors.asp. Best of luck!
__________________
![]() Validate your Markup Validate your CSS
|
|
|
|
|
|
#10 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Northampton, UK
Posts: 1,090
OS: Win Vista Home Premium & Ubuntu Hardy(8.04)
|
Re: Webpage that automatically adds new filenames
dm01 covored the font thing... that would work great... as for sorting you could use an array sorting function in the PHP part of the code:
(to build upon my last code:) PHP Code:
That should work(i think)... Cheers, Jamey |
|
|
|
![]() |
| Thread Tools | |
|
|