博客小熊

做一个充满激情的男人

Entries for the ‘Discuz’ Category

discuz 生成缩络图的函数代码

<?php
define(”op_to_file”, 1); // output to file
define(”op_output”, 2); // output to browser
define(”op_not_keep_scale”, 4); // free scale
define(”op_best_resize_width”, 8); // scale to width
define(”op_best_resize_height”, 16); // scale to height
define(”cm_default”,0); // clipping method: default
define(”cm_left_or_top”,1); // clipping method: left or top
define(”cm_middle”,2); // clipping method: middle
define(”cm_right_or_bottom”,3); // clipping method: right or bottom
/**
* vxresize
*
* @param string $srcfile source file
* @param string $srcfile destination [...]

discuz 主题列表的主题后面显示略缩头像的插件

第一次写discuz的插件。原来的插件在forumdisplay调用了头像,但是按一个头像20k来算,一页列表有30个主题,打开此页面需要加载600+,这样的插件没几个人敢装了。修改的文件: memcp.php forumdisplay.php forumdisplay.html 新增一个 avatar_s.inc.php函数来生成略缩图文件。初步测试成功,正在改进不,做好了就会放出来。

手工开启discuz4.1页面静态化

首先的第一点是确认你的服务器支持 rewrite mod 不然请略过此文。
具体方法
首页后台开启 页面静态化的选项[表告诉我你不知道那个东西在那里。]
接着进入论坛根目录,像我的论坛根目录就是/bbs
在/bbs 这个目录里面新建一个文件 .htaccess,内容如下
rewriteengine on
rewritebase /
rewriterule ^archiver/([a-z0-9\-]+\.html)$ archiver/index.php?$1
rewriterule ^forum-([0-9]+)-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2
rewriterule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extra=page\%3d$4&page=$2
rewriterule ^profile-(username|uid)-(.*)\.html$ viewpro.php?$1=$2
.htaccess 上传试试 rewritebase / 中“/”为根目录 如果是bbs改为“/bbs”
如无法保存,附件有 .htaccess 下载回去自己改
htaccess.rar