Mình không dùng ipb 2.1.x, nhưng vì có bạn hỏi về cách tạo nút media & flash trong 2.1.x nên đã cài thử trên localhost để thử tìm hiểu. Và đây là cách tạo nút media & flash (ai thích thêm nút post real nữa thì cứ dựa theo code này mà thêm thôi)
- Download file ảnh về, cho 2 file flash.gif & media.gif vào thư mục style_images\xxx\folder_rte_images
- Vào ACP --> Look & Feel --> Skin Manager --> Edit Template HTMl --> editor_std
Tìm:
CODE
// Easy prompts
Thêm bên trên:
CODE
// Media & Flash
var text_enter_media = "Enter URL to the media file";
var text_enter_flash = "Enter URL to the flash file";
var text_enter_size = "Enter the size for the flash file";
var text_enter_state = "Auto play? ( yes = '' 1 '' || no = '' 0 '' )";
- ACP --> Look & Feel --> Skin Manager --> Edit Template HTMl --> editor_std
Tìm:
CODE
<td><div><img class="rteimage" src="{ipb.vars['img_url']}/folder_rte_images/hyperlink.gif" width="25" height="24"
alt="{ipb.lang['js_tt_link']}" title="{ipb.lang['js_tt_link']}" onclick="tag_url()"></div></td>
<td><div><img class="rteimage" src="{ipb.vars['img_url']}/folder_rte_images/email.gif" width="25" height="24"
alt="{ipb.lang['js_tt_email']}" title="{ipb.lang['js_tt_email']}" onclick="tag_email()"></div></td>
<td><div><img class="rteimage" src="{ipb.vars['img_url']}/folder_rte_images/image.gif" width="25" height="24"
alt="{ipb.lang['js_tt_image']}" title="{ipb.lang['js_tt_image']}" onclick="tag_image()"></div></td>
<!--SEP-->
<td><img class="rteVertSep" src="{ipb.vars['img_url']}/folder_rte_images/blackdot.gif" width="1" height="20"
border="0" alt=""></td>
<!--/SEP-->
Thêm dưới:
CODE
<td><div><img class="rteimage"
src="{ipb.vars['img_url']}/folder_rte_images/media.gif" alt="{ipb.lang['js_tt_media']}" title="{ipb.lang['js_tt_media']}"
onclick="tag_media()"></div></td>
<td><div><img class="rteimage" src="{ipb.vars['img_url']}/folder_rte_images/flash.gif"
alt="{ipb.lang['js_tt_flash']}" title="{ipb.lang['js_tt_flash']}" onclick="tag_flash()"></div></td>
<!--SEP-->
<td><img class="rteVertSep" src="{ipb.vars['img_url']}/folder_rte_images/blackdot.gif" width="1" height="20"
border="0" alt=""></td>
<!--/SEP-->
- Mở file cache\lang_cache\xxx\lang_editors.php. Tìm:
CODE
$lang = array (
Thêm vào sau:
CODE
'js_tt_media' => "Insert Media",
'js_tt_flash' => "Insert Flash",
- Mở file jscripts/editor_std.js
Tìm:
CODE
/*-------------------------------------------------------------------------*/
// Toggle button highlighting (used when clicked on)
/*-------------------------------------------------------------------------*/
Thêm vào trước đó:
CODE
/*-------------------------------------------------------------------------*/
// Media & Flash
/*-------------------------------------------------------------------------*/
function tag_media()
{
var FoundErrors = '';
var enterINFO = prompt(text_enter_media, "http://");
var enterSTATE = prompt(text_enter_state, "1");
if ( ! enterINFO ) {
FoundErrors += " " + error_no_url;
}
if ( ! enterSTATE ) {
FoundErrors += " " + error_no_url;
}
if ( FoundErrors ) {
alert("Error! " + error_no_url);
return;
}
wrap_tags( "[media="+enterSTATE+"]"+enterINFO+"[/media]", "" );
}
function tag_flash()
{
var FoundErrors = '';
var enterINFO = prompt(text_enter_flash, "http://");
var enterSIZE = prompt(text_enter_size, "500");
if (! enterINFO ) {
FoundErrors += " " + error_no_url;
}
if ( ! enterSIZE ) {
FoundErrors += " " + error_no_url;
}
if ( FoundErrors ) {
alert("Error! " + error_no_url);
return;
}
wrap_tags( "[flash="+enterSIZE+"]"+enterINFO+"[/flash]", "" );
}
- Vô ACP -> Management --> Add New BBCode
Custom BBCode Title: Media
Custom BBCode Description: Post Media
Custom BBCode Example:
CODE
[media=1]This is an example![/media]
Custom BBCode Tag: Media
Use Option in tag?: Chọn Yes
Custom BBCode Replacement: điền đoạn sau:
CODE
<OBJECT id=Player height=45 width=500
classid=clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6>
<PARAM NAME="URL" VALUE='{content}'><PARAM NAME="rate" VALUE="1">
<PARAM NAME="balance" VALUE="0">
<PARAM NAME="currentPosition" VALUE="1">
<PARAM NAME="defaultFrame" VALUE="">
<PARAM NAME="playCount" VALUE="1"><PARAM NAME="autoStart"
VALUE="{option}">
<PARAM NAME="loop" VALUE="-1"><PARAM NAME="currentMarker"
VALUE="0">
<PARAM NAME="invokeURLs" VALUE="-1"><PARAM NAME="baseURL"
VALUE="">
<PARAM NAME="volume" VALUE="100"><PARAM NAME="mute" VALUE="0">
<PARAM NAME="uiMode" VALUE="full">
<PARAM NAME="stretchToFit" VALUE="0">
<PARAM NAME="windowlessVideo" VALUE="0">
<PARAM NAME="enabled" VALUE="-1">
<PARAM NAME="enableContextMenu" VALUE="0">
<PARAM NAME="fullScreen" VALUE="0"><PARAM NAME="ShowDisplay"
VALUE="0">
<PARAM NAME="ShowStatusBar" VALUE="0"><PARAM NAME="SAMIStyle"
VALUE="">
<PARAM NAME="SAMILang" VALUE=""><PARAM NAME="SAMIFilename"
VALUE="">
<PARAM NAME="captioningID" VALUE=""><PARAM NAME="enableErrorDialogs"
VALUE="0">
<PARAM NAME="_cx" VALUE="7938"><PARAM NAME="_cy" VALUE="6482">
<embed type='application/x-mplayer2' autostart="{option}" src='{content}' height="400"
width="450"></embed></OBJECT>
Add BBCode
Thêm tiếp BBCode:
Custom BBCode Title: Flash
Custom BBCode Description: Post Flash
Custom BBCode Example:
CODE
[flash=500]This is an example![/flash]
Custom BBCode Tag: Flash
Use Option in tag?: Chọn Yes
Custom BBCode Replacement: điền đoạn sau:
CODE
<embed type='application/x-shockwave-flash' src='{content}' width='{option}' height='{option}'></embed>
Xong! Đọan thẻ media trên cũng chống click chuột phải. Ai copy sang diễn đàn khác để lại hộ cái tên mình nhé lol