Jump to content
xisto Community
Sign in to follow this  
pbolduc

Reading Files And Folders

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.