Re: [PHP] * populate menu from directory *
Matt Matijevich wrote: snip I want to be able to simply FTP a new movie onto the server, and then have the menu update itself. possible? I would also be looking to do something similar with JPGS. /snip here is some code to help start you Here's another example: (more error checking probably needed) http://hills.ccsf.edu/~pfurma02/index.php -modified from screen to jpeg -eliminates screens that are already in the menu h2JPEG Image Menu:/h2 ?php chdir (JPEG_DIRECTORY); $fh=opendir(./); # extract count screens while ($file = readdir($fh)) { if (strstr ($file, '.jpg')){ $screens[] = $file; # store screename } } foreach ($screens as $value){ # eliminate unwanted screens # if (!(ereg('private|test', $value, $found))){ ? a href=index.php?SCREEN= ?php print $value; ? ?php print $value; ?/a?php } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] * populate menu from directory *
Hi there - I am a REAL new PHP coder (yeah I mostly use dreamweaver). I was wondering if anyone could point me in the right direction... What I want to do is have a generic template page for say a bunch of quicktime movies... it would have a movie embedded, and a drop down menu below to select the movie you want to watch.. what I was hoping to do was have the menu populated by pulling the file names from the movies in the directory on the server. I want to be able to simply FTP a new movie onto the server, and then have the menu update itself. possible? I would also be looking to do something similar with JPGS. d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] * populate menu from directory *
Yes, it is possible. Use PHP's filesystem functions (http://us2.php.net/manual/en/ref.filesystem.php). Shaunak -Original Message- From: Dustin Krysak [mailto:[EMAIL PROTECTED] Sent: Monday, February 16, 2004 2:33 PM To: PHP Subject: [PHP] * populate menu from directory * Hi there - I am a REAL new PHP coder (yeah I mostly use dreamweaver). I was wondering if anyone could point me in the right direction... What I want to do is have a generic template page for say a bunch of quicktime movies... it would have a movie embedded, and a drop down menu below to select the movie you want to watch.. what I was hoping to do was have the menu populated by pulling the file names from the movies in the directory on the server. I want to be able to simply FTP a new movie onto the server, and then have the menu update itself. possible? I would also be looking to do something similar with JPGS. d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] * populate menu from directory *
Dustin -- You have started a new thread by taking an existing message and replying to it while merely changing the Subject: line. That is bad, because it breaks threading. When you reply to a message, your mail client generates a References: header that tells everyone to which posting(s) your posting refers. A good mail client uses this information to build a thread tree of the postings so that it is easy to see just how they relate to each other. With your posting style you successfully torpedoed this useful feature; your posting shows up within an existing thread even though it is completely unrelated. Always do a fresh post when you want to start a new thread. That means that you do not select any sort of Reply when you start your message. You can save the list address in your address book (or equivalent) for convenience. ...and then Dustin Krysak said... % % Hi there - I am a REAL new PHP coder (yeah I mostly use dreamweaver). I Welcome, and hang on for a great ride :-) % was wondering if anyone could point me in the right direction... What I % want to do is have a generic template page for say a bunch of quicktime Good enough. % movies... it would have a movie embedded, and a drop down menu below to % select the movie you want to watch.. what I was hoping to do was have % the menu populated by pulling the file names from the movies in the Easy enough, especially depending on where they live. % directory on the server. I want to be able to simply FTP a new movie % onto the server, and then have the menu update itself. possible? I % would also be looking to do something similar with JPGS. 1) There are lots of gallery scripts out there, so you might look around and avoid reinventing the wheel. 2) If the files are in the same directory as the script, just open the dir and walk through it. Be sure to not present '.' or '..' in the menu (but still check whatever input you get back anyway). If they're off in some master directory, then do the same thing but look over there. 3) If the file paths are stored in a database, just connect to the DB and pull the list and then loop through it just as in #2. % % % d HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] * populate menu from directory *
snip I want to be able to simply FTP a new movie onto the server, and then have the menu update itself. possible? I would also be looking to do something similar with JPGS. /snip take a look at http://www.php.net/readdir http://www.php.net/opendir here is some code to help start you echo 'select name=movies'; if ($handle = opendir('moviesdirectory')) { while (false !== ($file = readdir($handle))) { if (preg_match(/\.mov$/i, $file)) { //the regular expression might have to be modified to allow for the file extensions you want to use echo option$file/option\n; } } closedir($handle); } echo '/select'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php