Discuz教程网

[代码修改] Discuz X2 发布主题自动增加日期功能

[复制链接]
authicon dly 发表于 2011-8-30 20:34:51 | 显示全部楼层 |阅读模式
修改方法:

修改文件:source/include/post/post_newthread.php

修改方法:
  1、  查找:
  1. DB::query("INSERT INTO ".DB::table('forum_thread')." (fid, posttableid, readperm, price, typeid, sortid, author, authorid, subject, dateline, lastpost, lastposter, displ
  2. VALUES ('$_G[fid]', '0', '$readperm', '$price', '$typeid', '$sortid', '$author', '$_G[uid]', '$subject', '$_G[timestamp]', '$_G[timestamp]', '$author', '$display
  3. $tid = DB::insert_id();
复制代码

2、在这段代码上一行添加代码:
  1. if ((substr($subject,1,2) != date("m",time())) && (substr($subject,1,1) != date("n",time()))){
  2. $newdate="[".date("m",time()).".".date("j",time())."]";
  3. $subject=$newdate.$subject; }
复制代码

修改完成。
   ps:  1、此功能可以自动给主题贴标题添加例如[08.29]这样格式的日期标志,美化贴子列表显示,并让会员更容易了解贴子时效。
          2、此功能可能会造成贴子标题过长,会自动丢失标题末尾超过长度的字符,请发贴时注意题标长度。




上一篇:【原创论坛等级图标】我刚做好就发上来了
下一篇:Discuz X2 设置分类信息(图文教程、DZX系列)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-6-17 16:03

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表