总是感觉 blog 文章的排版不怎么顺眼。我觉得程序在每行前面应该加入空格 , 即
    


这样看起来就美观多了。但不知道怎么修改才可达到这个效果呢?

我知道用 preg_replace 的 php 替换函数就可以实现这个功能,不过找了程序源码,还以为在 admin/cp_edit.php 里面修改,不过尝试修改了一下,没有成功。
后来发现这个应该修改 global.php 文件才对。
源码:

 $string=str_replace("\r","<br/>",$string);
 $string=str_replace("\n","",$string);
 $string=str_replace("\t","&nbsp;&nbsp;",$string);
 $string=str_replace("  "," &nbsp;",$string);
 $string=str_replace('|', '&#124;', $string);
 $string=str_replace("&amp;#96;","`",$string);
 $string=str_replace("&amp;#92;","\",$string);
 $string=str_replace("&amp;#91;","[",$string);
 $string=str_replace("&amp;#93;","]",$string);


我尝试将
 $string=str_replace("\r","<br/>",$string);

改成
 $string=str_replace("\r","<br/>&nbsp;&nbsp;",$string);

表面上是可以了,但又有另外的问题
1。只能在后续换行加入空格,最前面的那一行不行。
2。如果这篇文章有了多次的修改,每行的空格会逐渐累加。
再看看怎么解决, 不知道在 skin 模板修改这个是否可以。
博客技术 | 评论(1) | 引用(0) | 阅读(2147)
临时解决方案:

修改文件:lang/zh-cn/backend.php
在前面加入语言字段

// bushi hack - 加入全角空格 ( &emsp;&emsp; )
twospace=>"插入两个全角空格",

修改文件: editor/ubb/editordef.php
查找:
if (is_firefox) {
  document.write("<a href='JavaScript: void(0); '><IMG border=0 onclick='undo_fx();' title='{$lna[703]}' src='editor/ubb/images/undo.gif' ></a>");
}

</script>

在下面添加:

&nbsp;&nbsp;<!-- // bushi hack - 加入全角空格 -->
<a href="JavaScript: void(0); "><IMG border=0 onclick="AddText('&emsp;&emsp;')" title="{$lna[twospace]}" src="editor/ubb/images/twospace.gif" ></a>


并制作或找一个合适的 editor/ubb/images/twospace.gif 文件。a
分页: 1/1 第一页 1 最后页
发表评论
表情
emotemotemot
emotemotemot
emotemotemot
emotemotemot
emotemotemot
emotemotemot
emotemotemot
emotemotemot
emot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 不区分大小写