新闻中心
无忧主机推荐 修改phpbb 关于URL连接的显示方式
虽然phpbb拥有强大的处理速度,但是phpbb也有很多地方做的不够好,比如url连接方式不方便,这样会影响用户体验效果,对网站优化不和谐,那么我们该如何处理phpbb的URL链接不方便的问题呢。无忧主机(www.51php.com)小编参考了php中文官方的方法。成功实现了。原始url连接如下图所示:
[caption id="attachment_14399" align="alignnone" width="550"] phpbb[/caption]
URL连接有两种方式,一种是直接在页面上插入URL如:www.51php.com.另外一种是给文字添加链接,如:php虚拟主机,链接到www.51php.com 具体实现方法如下。
一、在页面上直接插入URL
首先通过您的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]
无忧主机相关文章推荐阅读:
PHPBB如何找回网站后台管理员密码
PHPBB论坛系统安装中文语言包的完整教程
如何在PHPBB论坛首页调用最新帖子和最新回复
PHPBB防御刷帖技巧设置限制规定时间内会员发帖数
本文地址:https://www.51php.com/phpbb/14398.html






