Sep 11

用ubb代码在日志中插入MP3(Flash)播放器 晴

蒙巴 , 15:25 , 后仓房 » 网站建设 , 评论(3) , 引用(0) , 阅读(6534) , Via 本站原创 | |
在论坛看到这个帖子,感觉跟我之前介绍给大家的flash播放器精选结合起来用非常方便,特转发此帖。
作者:独来读网
演示:

实现方法:
1、上传 audioplayer.js 和 audioplayer.swf 文件到 plugin 目录下,上传 fmp.gif 到 editor/ubb/images 目录下;
下载文件
这个文件只能在登入之后下载。请先 注册登入

2、打开 inc/ubb.php 文件,找到
$str =($inrss==0) ?  preg_replace("/\[(wmp|swf|real|flv)=([^\[\<]+?),([^\[\<]+?)\]\s*([^\[\<\r\n]+?)\s*\[\/(wmp|swf|real|flv)\]/ies", "makemedia('\\1', '\\4', '\\2', '\\3')", $str) : preg_replace("/\[(wmp|swf|real|flv)=([^\[\<]+?),([^\[\<]+?)\]\s*([^\[\<\r\n]+?)\s*\[\/(wmp|swf|real|flv)\]/is", "<br/>{$lnc[267]}<br/>", $str);

替换成
$str =($inrss==0) ?  preg_replace("/\[(wmp|swf|real|flv|fmp)=([^\[\<]+?),([^\[\<]+?)\]\s*([^\[\<\r\n]+?)\s*\[\/(wmp|swf|real|flv|fmp)\]/ies", "makemedia('\\1', '\\4', '\\2', '\\3')", $str) : preg_replace("/\[(wmp|swf|real|flv|fmp)=([^\[\<]+?),([^\[\<]+?)\]\s*([^\[\<\r\n]+?)\s*\[\/(wmp|swf|real|flv|fmp)\]/is", "<br/>{$lnc[267]}<br/>", $str);

找到
$typedesc=array('wmp'=>'Windows Media Player', 'swf'=>'Flash Player', 'real'=>'Real Player', 'flv'=>'Flash Video Player');
$mediapic=array('wmp'=>'wmp.gif', 'swf'=>'swf.gif', 'real'=>'real.gif', 'flv'=>'swf.gif');
$str="<div class=\"quote\"><div class=\"quote-title\"><img src=\"{$template['images']}/{$mediapic[$mediatype]}\" alt=\"\"/>{$typedesc[$mediatype]}{$lnc[268]}</div><div class=\"quote-content\"><a href=\"javascript: playmedia('player{$id}', '{$mediatype}', '{$url}', '{$width}', '{$height}');\">{$lnc[269]}</a><div id='player{$id}' style='display:none;'></div></div></div>";

替换成
$typedesc=array('wmp'=>'Windows Media Player', 'swf'=>'Flash Player', 'real'=>'Real Player', 'flv'=>'Flash Video Player', 'fmp'=>'Audio Player');
$mediapic=array('wmp'=>'wmp.gif', 'swf'=>'swf.gif', 'real'=>'real.gif', 'flv'=>'swf.gif', 'fmp'=>'fmp.gif');
if($mediatype=='fmp')
  $str="<object type='application/x-shockwave-flash' data='plugin/audioplayer.swf' width='290' height='24' id='audioplayer{$id}'><param name='movie' value='plugin/audioplayer.swf' /><param name='FlashVars' value='playerID={$id}&soundFile={$url}'/><param name='quality' value='high' /><param name='menu' value='false' /><param name='wmode' value='transparent' /></object>";
  else
$str="<div class=\"quote\"><div class=\"quote-title\"><img src=\"{$template['images']}/{$mediapic[$mediatype]}\" alt=\"\"/>{$typedesc[$mediatype]}{$lnc[268]}</div><div class=\"quote-content\"><a href=\"javascript: playmedia('player{$id}', '{$mediatype}', '{$url}', '{$width}', '{$height}');\">{$lnc[269]}</a><div id='player{$id}' style='display:none;'></div></div></div>";

注:在这里修改
<param name='FlashVars' value='playerID={$id}&soundFile={$url}'/>

替换
<param name='flashvars' value='playerID={$id}&bg=0xEAF4F5&leftbg=0x49BEFB&lefticon=0xFFFFFF&rightbg=0xFF8500&rightbghover=0xA5D200&righticon=0xFFFFFF&righticonhover=0x2E8B57&text=0x666666&slider=0xAAAAAA&track=0xFFFFFF&border=0x666666&loader=0xCCEE00&soundFile={$url}'/>

可以修改播放器颜色
3、打开 editor/ubb/editordef.php 文件,找到
<a href="JavaScript: void(0); "><IMG border=0 onclick="addmedia('flv');" title="{$lna[1014]}" src="editor/ubb/images/flv.gif" ></a>

在后面添加
<a href="JavaScript: void(0); "><IMG border=0 onclick="addmedia('fmp');" title="{$lna[1015]}" src="editor/ubb/images/fmp.gif" ></a>

4、最后,进入后台参数设置,在 区域额外代码里加入下列代码即可实现。
<script type="text/javascript" src="plugin/audioplayer.js"></script>




原贴地址:http://www.bmforum.com/bmb/topic_134837
参考:http://www.mylxj.cn/blog/read.php?69
Tags: ,
lemnear
September 21, 2006 07:53
请问这个可以用于其他的flash音乐播放器吗?smile
Ingrid 回复于 October 5, 2006 11:45
可以的~
564zj7411540
October 23, 2006 17:12
flasn
abcd
December 12, 2006 10:23
anger
分页: 1/1 第一页 1 最后页
发表评论
表情
emotemotemotemot
emotemotemotemot
emotemotemotemot
emotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
   
您也可用OpenID登入: