u can use the function function GetDirArray($sPath) { //Load Directory Into Array $handle=opendir($sPath); while ($file = readdir($handle)) if(($file!=".")&($file!="..")) $retVal[(isset($retVal))?count($retVal):0] = $file; //Clean up and sort closedir($handle); sort($retVal); return $retVal; } //and then count($a=GetDirArray($sPath))
-- Best regards, George Nicolae IT Manager ___________________ X-Playin - Professional Web Design www.x-playin.f2s.com "Bogdan Stancescu" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Just a suggestion: use exec("ls -1 root/articles/??_head.xml",$article_files) to > find out the files -- then walk $article_files, parse the file and echo whatever > you please. :-) > > Bogdan > > Martin Hughes wrote: > > > Heya, > > > > Can PHP count the number of a certain ftile in a directory and then print > > the result to the screen? I have articles on my site that are in XML/XSL > > format like: > > > > root/articles/00_head.xml > > 00_body.xml > > 01_head.xml > > 01_body.xml > > 02_head.xml > > 02_body.xml > > etc... (with appropriate XSL stylesheets too...) > > > > and I want to have a main "article page" with the head.xml info on it: > > > > Article 00: > > By: <author> > > Date: <whatever date> > > Subject: <subject> > > > > and then a link to the article itself (which will be an XSL stylesheet > > loading both the header info and the article body.xml). > > > > Can php count the number of articles etc in the dir and then automatically > > create the page? (or can anyone think of a better way of doing this???? :-)) > > > > Cheers, > > > > Martin > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]