四海人民公摄 - 海外华人摄影爱好者论坛

 找回密码
 注册
搜索
热搜: 活动 交友 discuz
查看: 1312|回复: 0

如何在My little forum 里贴 Youtube

[复制链接]
发表于 2014-2-23 13:00:13 | 显示全部楼层 |阅读模式
Easy YouTube embed hack (General)

by Bubba @, Saturday, November 02, 2013, 08:20 (113 days ago)
edited by Bubba, Saturday, November 02, 2013, 08:42

I looked all over the place and couldn't find an easy way to get YouTube embedding to work. Everything I found was either going to be a pain for me to implement, or a pain for the users, or both, so I decided to come up with my own fix. This is the absolute simplest way I can think of to get YouTube embedding to work.

In the file functions.inc.php, in the function do_bbcode_flash, place the code below just after the else and before the line:

    $html = '<!--[if IE]>

The else is at line 575 in my copy and I don't think I've added any lines of code, but you can just search for the function name.
  1.     if (strpos($content,"http://youtu.be/") !== false) {
  2.      $content = str_replace("http://youtu.be/", "http://www.youtube.com/v/", $content);
  3.     }

  4.     if (strpos($content,"http://www.youtube.com/watch?v=") !== false) {
  5.      $content = str_replace("http://www.youtube.com/watch?v=", "http://www.youtube.com/v/", $content);
  6.     }
复制代码
Once that is in place you can just click on the flash button and paste a video share link in the flash url box. It don't get much simpler than that :-D

I can't guaranty it will work forever, YouTube may change their urls in the future, but until then it should be good ;-)

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|四海人民公摄 - 海外华人摄影爱好者网站

GMT+8, 2024-11-21 20:41

Powered by Discuz! X3.5

Copyright © 2001-2023 Tencent Cloud.

快速回复 返回顶部 返回列表