Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[求助] 请教:UCH2.0用index.htm做首页,怎么添加“站长推荐”和“竞价排名”?

[复制链接]
fyl00 发表于 2010-11-15 22:17:42 | 显示全部楼层 |阅读模式
本帖最后由 fyl00 于 2010-11-15 23:05 编辑

我用index.htm做首页,不是默认的“随便看看”(network.htm)。我把network.htm里面“站长推荐”、“竞价排名”和“在线会员”的代码拷到index.htm里,但是不会显示,请问该怎么设置,或是还需要修改什么地方。
请教下各位,知道的请说一下。
致谢!
yfxz 发表于 2010-11-16 10:54:14 | 显示全部楼层
回复

使用道具 举报

miaodo 发表于 2010-11-18 09:43:54 | 显示全部楼层
使用 index.htm 作首页.在隐私设置里,不向游客开放浏览就OK了,登陆时,就会使用 index.htm作为首页了

至于你要在 index.htm上显示 “站长推荐”、“竞价排名”和“在线会员”,需要做两个工作

1.在 index.htm中,将 network.htm中的 “站长推荐”、“竞价排名”和“在线会员” 相关代码都要拷到 index.htm中

2.需要将 /source/network.php 中的 相关函数引用,也要拷到 /index.php中
回复

使用道具 举报

 楼主| fyl00 发表于 2010-11-18 12:19:51 | 显示全部楼层
本帖最后由 fyl00 于 2010-11-18 12:28 编辑

谢谢楼上老兄指点。
index.htm中已添加 network.htm中的 “站长推荐”、“竞价排名”和“在线会员” 相关代码。
index.php中也改为了index.htm作为首页。现在访问网站的首页已是index.htm.
只是 “站长推荐”、“竞价排名”和“在线会员”还是不显示。
本人不太熟悉PHP,我直接把/source/network.php 中的
//站长推荐
$star = array();
$starlist = array();
if($_SCONFIG['spacebarusername']) {
        $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('space')." WHERE username IN (".simplode(explode(',', $_SCONFIG['spacebarusername'])).")");
        while ($value = $_SGLOBAL['db']->fetch_array($query)) {
                realname_set($value['uid'], $value['username'], $value['name'], $value['namestatus']);
                $starlist[] = $value;
        }
}
if($starlist) {
        $star = sarray_rand($starlist, 1);
}

//竞价排名
$showlist = array();
$query = $_SGLOBAL['db']->query("SELECT sh.note, s.* FROM ".tname('show')." sh
        LEFT JOIN ".tname('space')." s ON s.uid=sh.uid
        ORDER BY sh.credit DESC LIMIT 0,23");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        realname_set($value['uid'], $value['username'], $value['name'], $value['namestatus']);
        $value['note'] = addslashes(getstr($value['note'], 80, 0, 0, 0, 0, -1));
        $showlist[$value['uid']] = $value;
}
if(empty($star) && $showlist) {
        $star = sarray_rand($showlist, 1);
}

//在线用户
$onlinelist = array();
$query = $_SGLOBAL['db']->query("SELECT s.*, sf.note FROM ".tname('session')." s
        LEFT JOIN ".tname('spacefield')." sf ON sf.uid=s.uid
        ORDER BY s.lastactivity DESC LIMIT 0,12");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if(!$value['magichidden']) {
                $value['note'] = shtmlspecialchars(strip_tags($value['note']));
                realname_set($value['uid'], $value['username']);
                $onlinelist[$value['uid']] = $value;
        }
}
if(empty($star) && $onlinelist) {
        $star = sarray_rand($onlinelist, 1);
        foreach ($star as $key => $value) {
                $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('space')." WHERE uid='$value[uid]'");
                if ($subvalue = $_SGLOBAL['db']->fetch_array($query)) {
                        $star[$key] = array_merge($subvalue, $star[$key]);
                }
        }
}


//在线人数
$olcount = getcount('session', array());

拷到index.php中,还是不行。
可否详细一点说说index.php和index.htm中还要增加些什么语句?

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-10-6 20:35 , Processed in 0.084478 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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