Re: * populate menu from directory *
| From: | Paul Furman | Date: | Tue, 17 Feb 2004 18:32:15 +0000 |
| Subject: | Re: * populate menu from directory * | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-178001@lists.php.net to get a copy of this message | ||
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 youHere'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 <h2>JPEG 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
}
}