2012-05-27 43 views
1

我想建立一个文件浏览器,在点击时显示文件的相关信息。这个文件本身应该被加载到每个PHP的jwplayer中。JWPlayer的文件浏览器

我可以通过点击文件以某种方式做到这一点? 还是应该使用JavaScript? (我试图避免)

回答

2

通过listin创建一个文件浏览器,你想通过PHP outputing像列出所有文件:

<div id="player_container"></div> 
<a href="./files/file.mp4" onclick="playjw(this)" /> 
<a href="./files/file2.mp4" onclick="playjw(this)" /> 
<a href="./files/file3.mp4" onclick="playjw(this)" /> ect 

和功能

<script type='text/javascript'> 

var temp; 
var temphref; //these variables to get the href of the anchor back when opening 
       //another file so you could open the first file again 


function playjw(file) { 

var srcfile=file.href; 


juplayer('player_container').setup ({ 

'flashplayer': 'player.swf', 
'file': srcfile, 
'controlbar': 'bottom', 
'width': '470', 
'height': 320, 
'provider': 'http' 

}); 

return false; // this is required to not let the browser follow the link. 


} 
</script> 

改变自己如果有错误将ocour功能因为我可能已经忘了东西

0

如果您想使用文件浏览器,请使用基于php/javasript的脚本。除非你有太多时间,否则不要试图自己建造它。检查http://www.gerd-tentler.de/tools/filemanager/http://encode-explorer.siineiolekala.net/explorer/index.php。网络充满了优秀的免费脚本。根据您想要如何使用jwplayer(audio?video?),您可以轻松创建播放文件的div(请参阅jw文档)或创建播放文件的iframe。

最简单的方法是为所有以.mpg或.mp3结尾的文件创建一个onclick事件来创建div/iframe。

+0

谢谢,但我现在有太多时间了。我想自己建立它;) 我现在试图通过使用$ _GET变量(我试图避免)来解决它。 – Manticore