pbolduc
Dec 26 2007, 02:04 AM
| | I am in the process of writing a small content management system for my niche sites and need to be able to accomplish the following two items. Any assistance would be appreciated:
I have a directory that has nothing but sub directories in it and I need to be able to identify each directory name and return them in an option drop down selection menu which will be included in an identifying URL.
ALSO:
I am in need of a script that could be included on a returned page that will read the content of a table and identify various keywords within the content and place a hyperlink around the particular keyword with the corresponding destination URL contained within.
Any assistance in these areas would be greatly appreciated:
Thanks in advance, pete |
Reply
altimit
Dec 31 2007, 06:48 PM
Hi pbolduc, PHP Directory and Filesystem Functions are your friends here. Have you considered looking at the PHP Manual for the relevant function already? In particular, the Directory Function "opendir" allows you to specify the directory you wish to access, and after which using "readdir" to get the filename of each suceeding entry, in a loop. In order for your script to know whether the returned entry by readdir is a file or a directory, you may use the Filesystem Function "is_dir", which returns a boolean true if the passed parameter corresponds to a directory entry. The PHP Manual entries for the functions I gave provide much sample code that will give you good insight on how to solve your problem; it should be very simple though as what you need is quite straightforward. Good luck.
Reply
Recent Queries:--
forreading vb toturial - 308.83 hr back. (1)
Similar Topics
Keywords : reading files folders- Reading Xml Data
- Within PHP (2)
- Magic Quotes And $_files
- (3)
It recently came upon me that I was designing a website that used file uploads. Of course, PHP was
my first choice to solve the problem. I'm pro-PHP and anti-ASP. Perl is somewhere in the middle.
But anyway! I have magic_quotes_runtime and magic_quotes_gpc both on and it seems to be causing
some problems with file uploads. If a user uploads a file called "Jared's Stuff.txt" (that was
one of my tests) then magic_quotes insert a backslash before the apostrophe and $_FILES becomes
"'s Stuff.txt" since the backslash is interpreted as part of the path. Is the...
How Do I Create And Write To Files?
- creating, writing, deleting files (4)
Hi, Can someone please tell me how to create files and write to them in PHP. I just want to create
a simple file containing text, and then be able to read it or update it. Thanks Alfie...
Php : Variables Included Dont Work In Functions
- Variables from Included files dont work (4)
Today, I came up with this strange PHP behaviour. Just wanted to know if anyone has any
suggestions! I make a common variable/function file called config.php. I put in my generally used
functions in it. Suppose this is my file // -----VARIABLES --- // $a=10,$b.... //
-----FUCTIONS--- // function doit() { print "A value is " . $a; } ?> Here, suppose we execute
this file directly. Since A has a global scope, it does work perfectly. But if this same file is
imported in another file say, mainfile.php // -----VARIABLES --- // $c,$d.... include
'config.ph...
How To Protect Included Files
- (10)
Hey! How can i make my included files 100% safe. Like if I include a file witht his code.. CODE
include "bla.php"; How can i make it 100% safe? I know I must close the php tags in the
included files. but what more =?...
Php File Upload
- About uploading files through php (3)
Right i have done a check for a tutorial on this as well as a question about it but php is not
allowed in the search box. So i thought i'd just ask what i want to know. I have a form which
uploads a file, it refreshes the page, uploads the file and then alerts the user to if the file has
uploaded. To be honest im not sure why i keep getting the error. But here is the code: This is the
form that is used for the user to select the file &fid= " method="POST"> Choose a file to
upload: This is the upload code if ($op == "up"...
Help To Transfer Files Within Hosting Space Using Php
- (4)
I want to transfer files from one folder to another or an entire folder in my web space. I don't
want to download it and upload it, can I do this using a PHP script. Please help me. I'm just
learning the basics of PHP...
How To Edit Php Files?
- (16)
Hi, You can use frontpage to preview HTML files, but how can I edit and preview PHP files offline.
I'm not well-known with PHP and I see more and more using this script to manage their site....
How To Delete Files When Session Ends
- (4)
Dear Friends I need solution to a problem. The problem is as under: I am creating certain files
(playlist) in server disk when user selects some songs. The files are created in ram format. What I
want to do is to delete these files created during a particular session. Is it possible to do so?
Now I am deleting these files using on Unload event fired by JavaScript. I am using PHP. ...
Reading Data From Sessions
- (2)
Hello everyone! Before I start let me just say that ive read many threads on here about php and
sessions, several tutorials and the php manual but I still cant find a solution to my problem. My
problem is that when i try to read data from a session it just comes up blank, and an if statement
to see if the variable is null returns true. The code im using is for a login script which checks
the input from a user and compares it with the data in a database to log the user in, this works
fine, also reading the data from the session works perfectly on the page which the sess...
Sessions, Setting, Unsetting, Reading
- and in combination w/ cookies (5)
I am making a login script which atm uses a cookie to set login status. I would like to include
sessionwise checking into this. And also an IP check, where i write the IP to database and later get
it for all other pages and then check it up to the client for each page. I need to know the
commands for: - getting an IP - Starting a session - Ending a session - Reading a session...
Deleting Files With PHP
- is this possible? (6)
It is posible for PHP to delete files on a server? If so, how is this possible? Just out of
interest......
Possible To Do?
- Reading a remote website's data .. (7)
What I need to know is how to do the following? I'm completely confused, although I sort of
have a general feel of what I need to do, I just have no clue how to do it. I need to be able to
take some data from one page, displayed on their site as an HTML table, and then output certain
pieces of it to my site. I will disclaim here and now that what I intend to do does not violate
any laws, as I'm not stealing a persons content. I am using this to act as an online counter, to
see how long someone is online. I also have emailed the company to ask if what I'm...
Php Reading And Writing To File
- the code is very esay (4)
this code to Read from file you can use this code in to make a small data base and it is very to
use CODE $fp = fopen ("file.txt", "r"); $bytes = 4; $buffer = fread($fp, $bytes); fclose
($fp); print $buffer; ------------------- to write to same file CODE $fp = fopen
("file.txt", "w+"); fwrite ($fp, "Test"); fclose ($fp); ---------------- thanks and iwait
the commant...
Getting Files From Other Sites
- Using wget (3)
Hello. A while ago, a friend showed me this PHP code (wget) which allows you to get files from other
sites. I was a simple one liner type thing. Since my old host (Nytka) went down, I've lost it,
as has my friend. Do you know anything about wget, and could tell me it?...
Looking for reading, files, folders
|
*SIMILAR VIDEOS*
Searching Video's for reading, files, folders
|
advertisement
|
|