(✔)修改Xiuno的帖子时间显示格式,将XX天前改成具体的年月日时分秒
已验证,需要修改源文件
Xiuno的时间格式显示的过于友好了,总是显示XX天前、XX月前,导致用户想看某个帖子的发布时间都不知道咋看。
下面提供修改方法,可以将这种“对人类友好”的格式改成常见的年月日时分秒样式。
打开xiunophp/misc.func.php,定位到第486行,找到如下代码:
if($seconds > 31536000) {
return date('Y-n-j', $timestamp);
}
打开xiunophp/xiunophp.min.php,定位到第56行,找到如下代码:
if($seconds > 31536000) { return date('Y-n-j', $timestamp); }
你看,这里的条件写的意思是,只有时间在31536000秒之前的,才会显示年月日,而且仍不显示时分秒!
31536000秒,换算一下,就是1年:
赶紧把这部分代码改一下:
if($seconds > 259200 ) { return date('Y-m-d H:i:s', $timestamp); }
意思是改成3天内的才显示友好格式,259200秒=3天
Y-m-d H:i:s=年月日,时分秒
也可以改成>0,加时间戳
注:
- date('Y-n-j') 2024-1-16
- date('Y-m-d') 2024-01-16
就是有零和没零的区别
(?)取XiunoBBS文章中第一张图片作为标题缩放图
取XiunoBBS文章中第一张图片作为标题缩放图
<?php
$pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";
$content = $_thread['message']; //文章内容
preg_match_all($pattern,$content,$matchContent);
if(isset($matchContent[1][0])){
$temp = $matchContent[1][0];
}
?>
正则匹配出文章的图片,然后选取一个,然后在用$temp 调用
<img src="<?php echo $temp;?>">
想把图片输出在列表,找到view/htm/forum.htm对应文件,然后根据样式自行调整。
如果想实现首页和列表页面调用从而达到缩略图封面效果请找到对应thread_list.inc.htm进行修改调用
(✔)XIUNO全站支持Emoji表情
有效果,已测试,可以直接用下面的代码
我没有bbs_post_update_log和bbs_notice这两个表,这两个插件没安装
操作步骤:操作之前需要有一定的动手能力,谨慎操
1. 修改数据库,在数据库中执行以下SQL代码(请把下面bbs_修改成你自己的表前缀后执行,如果是默认的是bbs_ 请直接复制):
ALTER TABLE `bbs_post`
MODIFY COLUMN `message` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL AFTER `quotepid`,
MODIFY COLUMN `message_fmt` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL AFTER `message`;
ALTER TABLE `bbs_post_update_log`
MODIFY COLUMN `message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL AFTER `reason`;
ALTER TABLE `bbs_thread`
MODIFY COLUMN `subject` char(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' AFTER `userip`;
ALTER TABLE `bbs_notice`
MODIFY COLUMN `message` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL AFTER `type`;
ALTER TABLE `bbs_modlog`
MODIFY COLUMN `subject` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' AFTER `pid`,
MODIFY COLUMN `comment` char(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' AFTER `subject`;
2. 修改配置文件conf/conf.php
把15行和32行的 'charset' => 'utf8', 修改为 'charset' => 'utf8mb4',
3. OK,去试试吧
补充:utf8mb4_unicode_ci 也可以使用 utf8mb4_general_ci
效果:🏃💃👯👜💼🐜🕷
(?)其它
alter table bbs_attach convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_cache convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_forum convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_forum_access convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_friendlink convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_group convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_haya_favorite convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_kv convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_modlog convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_mypost convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_mythread convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_notice convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_post convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_post_like convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_post_search convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_post_update_log convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_queue convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_session convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_session_data convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_table_day convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_tag convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_tag_cate convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_tag_thread convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_thread convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_thread_digest convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_thread_search convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_thread_top convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table bbs_user convert to character set utf8mb4 collate utf8mb4_general_ci;
(✔)页码翻页功能美化,手机上翻页列表条不会出现换行了
1. 去掉上一页和下一页
开发模式改
/xiunophp/misc.func.php
注释掉大约388行和394行的代码
$page != 1 && $s .= pagination_tpl(str_replace("{page}", $page-1, $url), "◀", "");
$page != $totalpage && $s .= pagination_tpl(str_replace("{page}", $page+1, $url), "▶")
线上模式改
/xiunophp/xiunophp.min.php
删除掉
$page != 1 && $s .= pagination_tpl(str_replace("{page}", $page-1, $url), "◀", "");
$page != $totalpage && $s .= pagination_tpl(str_replace("{page}", $page+1, $url), "▶");
2、缩短页码显示个数
开发模式改
/xiunophp/misc.func.php
大约第378行
$shownum = 5; // 显示多少个页 * 2
改为
$shownum = 2;
线上模式改
/xiunophp/xiunophp.min.php
搜索
$shownum = 5;
改为
$shownum = 2;
意思是左右各几个页码,5就是10个,2就是4个
.....