Welcome Guest ( Log In | Register )




                Web Hosting

 
Reply to this topicNew Topic
Reading Files And Folders
pbolduc
post Dec 26 2007, 02:04 AM
Post #1


Member - Active Contributor
Group Icon

Group: Members
Posts: 92
Joined: 15-December 04
From: New Mexico
Member No.: 1,759


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
Go to the top of the page
 
+Quote Post
altimit
post Dec 31 2007, 06:48 PM
Post #2


Member [ Level 1 ]
Group Icon

Group: Members
Posts: 30
Joined: 31-December 07
Member No.: 27,267


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.
Go to the top of the page
 
+Quote Post

Reply to this topicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No new   23 WeaponX 7,059 2nd January 2009 - 09:48 AM
Last post by: iG-jagadesh
No new 21 RGF 4,897 31st December 2008 - 07:22 PM
Last post by: Guest
No New Posts   15 soleimanian 7,876 13th December 2008 - 12:54 PM
Last post by: tek3D
No New Posts   11 elevenmil 4,750 10th December 2008 - 10:28 AM
Last post by: iG-rakesh
No New Posts   3 netc0n 2,525 3rd December 2008 - 07:52 AM
Last post by: iG-suman
No New Posts   7 indwebdesphs 1,320 1st December 2008 - 12:52 PM
Last post by: iG-biju
No New Posts   4 Vyoma 220 28th November 2008 - 08:51 PM
Last post by: yordan
No New Posts   3 TBK 271 25th November 2008 - 02:20 AM
Last post by: iG-paul
No New Posts   9 xerxes 873 24th November 2008 - 09:57 PM
Last post by: toby
No new   22 PureHeart 3,645 6th November 2008 - 12:38 AM
Last post by: Guest
No New Posts   5 Tavis 1,160 20th October 2008 - 03:50 AM
Last post by: FirefoxRocks
No New Posts   5 Feelay 410 9th October 2008 - 02:29 AM
Last post by: mikesoft
No New Posts 15 soleimanian 1,337 30th September 2008 - 10:01 AM
Last post by: magiccode9
No New Posts   9 Axis 2,186 2nd September 2008 - 08:41 PM
Last post by: Guest
No New Posts   5 ElFoReal 456 25th August 2008 - 06:51 AM
Last post by: Guest