paulman888888 Posted April 28, 2008 Share Posted April 28, 2008 I would like to have a master page that includes all other php files in directory 'games/'. This way i don't have to update the master page. Can anyone help me make the master page please? Thankyou Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted April 28, 2008 Share Posted April 28, 2008 be a little more deffinitive towards what you mean as a master page.. do you just want it to list the files contained.. or is there something more to it that you wanna do? Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted April 28, 2008 Author Share Posted April 28, 2008 i want it to include the php pages inside 'games/'. I have a games site and i want all games (10 at a time) in directory 'games/' to be include in the master page. thankyou Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted April 29, 2008 Author Share Posted April 29, 2008 this is my code so far <?php // open the current directory $dhandle = opendir('games/'); // define an array to hold the files $files = array(); if ($dhandle) { // loop through all of the files while (false !== ($fname = readdir($dhandle))) { // if the file is not this file, and does not start with a '.' or '..', // then store it for later display if (($fname != '.') && ($fname != '..') && ($fname != basename($_SERVER['PHP_SELF']))) { // store the filename $files[] = (is_dir( "./$fname" )) ? "(Dir) {$fname}" : $fname; } } // close the directory closedir($dhandle); } echo "<select name=\"file\">\n"; // Now loop through the files, echoing out a new select option for each one foreach( $files as $fname ) { echo "<option>{$fname}</option>\n"; } echo "</select>\n"; ?> I want to include each file into my page please help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.