Page 1 of 1

Loading a script from a different page

Posted: Sat Jan 31, 2009 2:47 pm
by Luigicamp
Hi guys,
I have been trying to find answers by googling and looking through various php forums, but I couldn't find anything; I am guessing because I didn't know the right question to ask in the first place, so here it is.

I have a script that allows me to count how many files are there in a specific folder.
This person "John Doe", is a movie reviewer, and has written a number of reviews that are stored in the folder "_2008"
With the code below, it appears as is:
John Doe - Total Reviews (115)

Code: Select all

 
John Doe - Total Reviews (<?php
$cnt=0;
$dirname="John_Doe/reviews/_2008/";
$dh = opendir($dirname);
while ($dave=readdir($dh))
{
//print "$dave <br>";
$cnt=$cnt+1;
}
closedir ($dh);
print ($cnt-2);
?>)
 
Now, what I would like to be able to do is to store that code in an external file, because if I have a list of many more reviewers in the future, all that coding will be on the way and would make the page messed up with codes.

E.g

John Doe - Total Reviews (pull results from external file)
Jane Doe - Total Reviews (pull results from external file)
And so on....

Could someone help me please?

Thank you in advance for your time.

Luigi

Re: Loading a script from a different page

Posted: Sat Jan 31, 2009 2:55 pm
by Benjamin