read folder and pass file name

i need to have the script read the file names in a folder and give each file a variable that it can pass to the following href=“http://someurl/filename that was clicked”
the file types would be flv files
ie:
chapter1.flv
chapter2.flv
chapter3.flv
ect
when some one clicks a chapter it sends the name to a script in an iframe

I assume they click links outside the frame which display inframe?

[php]
Chapter 1

[/php]

Guess i was not clear
when the script reads the directory
it makes the “menu” of the video’s
and passes the filename to the script that is in the other iframe
the files will be changed weekly and i really dont want to write the script over each week was hopping for a simple way

How are you grouping the videos? Do you set a certain number of videos for each week or a set of filenames for each week?

the names and number of the videos could change

So you want to display links for every file in a folder?

Yes each file in the folder would be turned into a link that would open in an iframe
was thinking that when you clicked the file name it would do a document.write to the iframe
but not sure what i am talking about

Something like this should work:

[php]$raw_files = scandir(’/some/video/path’);

foreach($raw_files as $file) {
if($file != ‘.’ && $file != ‘…’) {
echo ‘’, $file, ‘’;
}
}[/php]

ok seem that i have not made my problem clear
here is the code i am using with notes as to what i would like

[code]

<!-- 
	include flowplayer JavaScript file that does  
	Flash embedding and provides the Flowplayer API.
-->
<script type="text/javascript" src="flowplayer-3.2.6.min.js"></script>

<!-- some minimal styling, can be removed -->
<link rel="stylesheet" type="text/css" href="style.css">

<!-- page title -->
<title>Frank and Eric's detecting video's</title>
Menu here
	<p style="text-align: center">Frank and Eric detecting video's</p>
	
	<!-- this A tag is where your Flowplayer will be placed. it can be anywhere -->
	
	<center><!-- buckel.flv needs to be replaced with the name of the file to be played  in the next section-->
    <p><a  
		 href="http://98.15.160.45/detecting/detecting-movies/buckel.flv"
		 style="display:block;width:520px;height:330px"  
		 id="player"> 
	</a> </p>
    </center>

	<!-- this will install flowplayer inside previous A- tag. -->
	<script>
		flowplayer("player", "http://98.15.160.45/detecting/detecting-movies/flowplayer-3.2.7.swf");
	</script>

</div>
[/code]

if you go to my web server at http://98.15.160.45/detecting/detecting-movies/index1.html
you will see what i have setup so far
what i would like to do is have the script automatically read the folder and list the video’s
then the user could click and have that video play
to see what files i have on the server just drop the index1.html or click here 98.15.160.45/detecting/detecting-movies/
and it will bring up the list of files in the folder

First of all, you will have to use a PHP page rather than an HTML one to host the player, then you could use the similar code to before:

[php]$raw_files = scandir(’/some/video/path’);

foreach($raw_files as $file) {
if($file != ‘.’ && $file != ‘…’ && strstr($file, ‘.flv’)) {
echo ‘’, $file, ‘’;
}
}[/php]

And then modify your video code:

			 href="http://98.15.160.45/detecting/detecting-movies/buckel.flv"

Becomes:

[php] href=“http://98.15.160.45/detecting/detecting-movies/<?php if(isset($_GET['video'])) { echo $_GET['video']; } else { echo 'DEFAULT_VIDEO_NAME.flv'; } ?>”[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service