練功房推薦書單

  • Google!Android 3手機應用程式設計入門(第四版)
  • 賈伯斯傳(軟皮精裝版)
  • 猛虎出閘制霸版:最新OCP Java SE 6 Programmer專業認證(附原始程式碼及範例檔)
  • SCWCD 5 猛虎出閘:Java Web 應用程式專業認證
Add YouTube BB Code support for JForum  XML
Forum Index » JForum中文社群 JForum Chinese Users Community
Author Message
andowson

六段學員
[Avatar]

Joined: 2007-01-02 22:20:40
Messages: 652
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>
		]]&gt
		</replace>
	</match>

go to Admin Panel -&gt Cache -&gt 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.

This message was edited 8 times. Last update was at 2007-08-19 15:34:54


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

六段學員
[Avatar]

Joined: 2007-01-02 22:20:40
Messages: 652
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

This message was edited 2 times. Last update was at 2008-01-05 00:56:57


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