新聞中心
無憂主機(jī)推薦 修改phpbb 關(guān)于URL連接的顯示方式
雖然phpbb擁有強(qiáng)大的處理速度,但是phpbb也有很多地方做的不夠好,比如url連接方式不方便,這樣會(huì)影響用戶體驗(yàn)效果,對網(wǎng)站優(yōu)化不和諧,那么我們該如何處理phpbb的URL鏈接不方便的問題呢。無憂主機(jī)(www.love62.cn)小編參考了php中文官方的方法。成功實(shí)現(xiàn)了。原始url連接如下圖所示:
[caption id="attachment_14399" align="alignnone" width="550"] phpbb[/caption]
URL連接有兩種方式,一種是直接在頁面上插入U(xiǎn)RL如:www.love62.cn.另外一種是給文字添加鏈接,如:php虛擬主機(jī),鏈接到www.love62.cn 具體實(shí)現(xiàn)方法如下。
一、在頁面上直接插入U(xiǎn)RL
首先通過您的ftp工具連接您的空間。
然后找到根目錄下的/styles/prosilver(模版名)/templates/editor.js文件
最后打開editor.js文件編輯
查找下面這段代碼:
var bbcl= bbopen.replace( /\[|\]/g, '' ).toLowerCase();
var aType=
{ 'b': { cap: 'b' }
, 'i': { cap: 'i' }
, 'u': { cap: 'u' }
, 'img': { cap: 'p', pre: 'http://' }
, 'url': { cap: 'w', pre: 'http://', more: 'Description (optional)' }
}
if( aType[bbcl] ) {
var sPre= aType[bbcl]['pre']? aType[bbcl]['pre']: '';
var sIns= prompt( help_line[aType[bbcl]['cap']]+ ':', sPre );
if( sIns== null ) return;
if( aType[bbcl]['more'] ) {
var sMore= prompt( aType[bbcl]['more']+ ':' );
if( sMore!= null ) {
bbopen= bbopen.replace( /\]$/, '='+ sIns+ ']' );
sIns= sMore;
}
}
bbopen+= sIns;}添加后您就可以插入;URL連接了
二、給文字添加鏈接
采用同樣的方法,找到editor.js文件,找到下面這段代碼:
if ((clientVer >= 4) && is_ie && is_win)
{
// Get text selection
theSelection = document.selection.createRange().text;
if (theSelection)
{
在這段代碼后面添加:
if( bbopen.replace( /\[|\]/g, '' ).toLowerCase()== 'url' ) {
var bUrl= theSelection.search( /(^[a-z]+:|www\.)[^ ]+/i )!= -1;
var sIns= prompt( ( bUrl? 'Description / link title': 'URL' )+ ':', bUrl? '':'http://' );
if( sIns!= null ) {
if( bUrl ) {
bbopen= '[url=';
bbclose= ']'+ sIns+ bbclose;
} else bbopen= '[url='+ sIns+ ']';
}
}
找到代碼:
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd);
var s3 = (txtarea.value).substring(selEnd, selLength);
在其后面添加:
if( open.replace( /\[|\]/g, '' ).toLowerCase()== 'url' ) {
var bUrl= s2.search( /(^[a-z]+:|www\.)[^ ]+/i )!= -1;
var sIns= prompt( ( bUrl? 'Description / link title': 'URL' )+ ':', bUrl? '': 'http://' );
if( sIns!= null ) {
if( bUrl ) {
open= '[url=';
close= ']'+ sIns+ close;
} else open= '[url='+ sIns+ ']';
}
}
修改后的效果如下圖:
[caption id="attachment_14400" align="alignnone" width="236"]
phpbb[/caption]
無憂主機(jī)相關(guān)文章推薦閱讀:
PHPBB如何找回網(wǎng)站后臺(tái)管理員密碼
PHPBB論壇系統(tǒng)安裝中文語言包的完整教程
如何在PHPBB論壇首頁調(diào)用最新帖子和最新回復(fù)
PHPBB防御刷帖技巧設(shè)置限制規(guī)定時(shí)間內(nèi)會(huì)員發(fā)帖數(shù)
本文地址:http://www.love62.cn/phpbb/14398.html
![1](/wp-content/themes/starow_z/img/o-1.png)
![1](/wp-content/themes/starow_z/img/o-2.png)
![1](/wp-content/themes/starow_z/img/o-3.png)
![1](/wp-content/themes/starow_z/img/o-4.png)
![1](/wp-content/themes/starow_z/img/o-5.png)
![1](/wp-content/themes/starow_z/img/o-6.png)
![1](/wp-content/themes/starow_z/img/o-7.png)