練功房推薦書單

  • 猛虎出柙雙劍合璧版--最新 OCA / OCP Java SE 7 Programmer 專業認證 (電子書)
  • 流浪教師存零股存到3000萬(全新增修版)(書+DVD)
  • 開始在關西自助旅行(京都‧大阪‧神戶‧奈良)(全新增訂版)
  • 不敗教主的300張股票存股術

Add YouTube BB Code support for JForum RSS feed
Forum Index » JForum中文社群 JForum Chinese Users Community
Author Message
andowson

七段學員
[Avatar]

Joined: Jan 2, 2007
Messages: 727
Location: 台北
Offline
add the following code at the bottom of bb_config.xml:

<match name="youtube">
<regex>(?i)\[youtube\]http\:\/\/www.youtube.com\/watch\?v\=(.*?)\[/youtube\]</regex>
<replace>
<![CDATA[
<object width="425" height="350">
<param name="movie" value="http://www.youtube.com/v/$1"></param>
<param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>
</object>
]]>
</replace>
</match>

go to Admin Panel -> Cache -> Reload BB Code and it's done.

Usage:
[youtube]full URL of the YouTube Video[/youtube]


See http://www.andowson.com/posts/list/109.page for live demo.

分享經驗 累積智慧
[WWW]
andowson

七段學員
[Avatar]

Joined: Jan 2, 2007
Messages: 727
Location: 台北
Offline
The original post only supports URL in the form "www.youtube.com". However, if you change to another form, like "youtube.com" or "tw.youtube.com", it will not work. So, we need to modify the original bb_config.xml as follows:

<!-- YouTube -->
<match name="youtube">
<regex>
(?i)\[youtube\]http\:\/\/(.*?)youtube.com\/watch\?v\=(.*?)\[/youtube\]
</regex>
<replace>
<![CDATA[
<object width="450" height="370">
<param name="movie" value="http://$1youtube.com/v/$2"></param>
<param name="wmode" value="transparent"></param>
<embed src="http://$1youtube.com/v/$2" type="application/x-shockwave-flash" wmode="transparent" width="450" height="370"></embed>
</object>
]]>
</replace>
</match>

Now, the new form of URL works.

See:
http://www.jforum.net/posts/list/4269.page

分享經驗 累積智慧
[WWW]
 
Forum Index » JForum中文社群 JForum Chinese Users Community
Go to:   
Mobile view