发个小程序,证明我还或者,至于他们两个,就不清楚了
前端时间,在xoops上,东至同学发了Xoops整合Ucenter的方法,然后就可以使用Discuz了,只是首页无法调取Discuz的最新帖子,最新回复等! xoops上几个网友问了下,在下就搞个小程序出来了!
以下是代码
C.php
/*
Date:2008-11-17
$Id: c.php cfc4n $
$num 变量可以自己赋值,为最新帖子数量
*/
define('CURSCRIPT', 'c');
require_once './include/common.inc.php';
require_once DISCUZ_ROOT.'./include/forum.func.php';
$num = 10;
$thread = array();
$sql = "SELECT t.* , f.fid , f.name FROM {$tablepre}threads t , {$tablepre}forums f WHERE f.fid = t.fid ORDER BY `dateline` DESC LIMIT 0,$num";
$query = $db->query($sql);
while( $thread = $db->fetch_array($query)) {
$thread['icon'] = ' ';
$thread['lastposterenc'] = rawurlencode($thread['lastposter']);
$thread['typeid'] = '';
$thread['multipage'] = '';
$topicposts = $thread['special'] ? $thread['replies'] : $thread['replies'] + 1;
$thread['special'] == 3 && $thread['price'] < 0 && $thread['replies']--;
if($thread['highlight']) {
$string = sprintf('%02d', $thread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$thread['highlight'] = ' style="';
$thread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$thread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$thread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$thread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$thread['highlight'] .= '"';
} else {
$thread['highlight'] = '';
}
$thread['moved'] = 0;
if($thread['closed']) {
$thread['new'] = 0;
if($thread['closed'] > 1) {
$thread['moved'] = $thread['tid'];
$thread['tid'] = $thread['closed'];
$thread['replies'] = '-';
$thread['views'] = '-';
}
$thread['folder'] = 'lock';
} else {
$thread['folder'] = 'common';
if($lastvisit < $thread['lastpost'] && (empty($_DCOOKIE['oldtopics']) || strpos($_DCOOKIE['oldtopics'], 'D'.$thread['tid'].'D') === FALSE)) {
$thread['new'] = 1;
$thread['folder'] = 'new';
} else {
$thread['new'] = 0;
}
if($thread['replies'] > $thread['views']) {
$thread['views'] = $thread['replies'];
}
if($thread['replies'] >= $hottopic) {
$thread['folder'] = 'hot';
}
}
$thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600);
$thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);
if(in_array($thread['displayorder'], array(1, 2, 3))) {
$thread['id'] = 'stickthread_'.$thread['tid'];
$separatepos++;
} elseif(in_array($thread['displayorder'], array(4, 5))) {
$thread['id'] = 'floatthread_'.$thread['tid'];
} else {
$thread['id'] = 'normalthread_'.$thread['tid'];
}
$resulttid[] = $thread['tid'];
$threadlist[] = $thread;
}
include template('c');
?>
C.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=$charset" />
<title>$navtitle $bbname $seotitle - Powered by Discuz!</title>
$seohead
<meta name="keywords" content="{$metakeywords}$seokeywords" />
<meta name="description" content="$metadescription $bbname $seodescription - Discuz! Board" />
<meta name="generator" content="Discuz! $version" />
<meta name="author" content="Discuz! Team and Comsenz UI Team" />
<meta name="copyright" content="2001-2008 Comsenz Inc." />
<meta name="MSSmartTagsPreventParsing" content="True" />
<meta http-equiv="MSThemeCompatible" content="Yes" />
<link rel="archives" title="$bbname" href="{$boardurl}archiver/" />
$rsshead
$extrahead
<!--{if CURSCRIPT == 'viewthread'}-->
<link rel="stylesheet" type="text/css" href="forumdata/cache/style_{STYLEID}_viewthread.css" />
<!--{if $thread['special']}-->
<link rel="stylesheet" type="text/css" href="forumdata/cache/style_{STYLEID}_special.css" />
<!--{/if}-->
<!--{elseif CURSCRIPT == 'post'}-->
<link rel="stylesheet" type="text/css" href="forumdata/cache/style_{STYLEID}_editor.css" />
<!--{/if}-->
<link rel="stylesheet" type="text/css" href="forumdata/cache/style_{STYLEID}_common.css" />
<script type="text/javascript">
var discuz_uid = $discuz_uid;var IMGDIR = '{IMGDIR}';var attackevasive = '$attackevasive';var gid = 0;var STYLEID = '{STYLEID}';
<!--{if in_array(CURSCRIPT, array('viewthread', 'forumdisplay'))}-->gid = parseInt('$thisgid');<!--{elseif CURSCRIPT == 'index'}-->gid = parseInt('$gid');<!--{/if}-->var fid = parseInt('$fid');var tid = parseInt('$tid');
</script>
<script type="text/javascript" src="include/javascript/common.js"></script>
</head>
<body onkeydown="if(event.keyCode==27) return false;">
<div id="append_parent"></div><div id="ajaxwaitid"></div>
<div class="wrap">
<div class="mainbox threadlist">
<table summary="forum_$fid" {if !$separatepos}id="forum_$fid"{/if} cellspacing="0" cellpadding="0">
<thead class="category">
<tr>
<td class="folder"> </td>
<td class="icon"> </td>
<td class="forum">{lang forum}</td>
<th>{lang subject}</th>
<td class="author">{lang author}</td>
<td class="nums">{lang replies}/{lang views}</td>
<td class="lastpost">{lang lastpost}</td>
</tr>
</thead>
<!--{loop $threadlist $key $thread}-->
<tbody id="$thread[id]" {if in_array($thread['displayorder'], array(4, 5))}style="display: none"{/if}>
<tr>
<td class="folder"><a href="viewthread.php?tid=$thread[tid]&extra=$extra" title="{lang target_blank}" target="_blank"><img src="{IMGDIR}/folder_$thread[folder].gif" /></a></td>
<td class="icon">
<!--{if $thread['special'] == 1}-->
<img src="{IMGDIR}/pollsmall.gif" alt="{lang thread_poll}" />
<!--{elseif $thread['special'] == 2}-->
<img src="{IMGDIR}/tradesmall.gif" alt="{lang thread_trade}" />
<!--{elseif $thread['special'] == 3}-->
<!--{if $thread['price'] > 0}-->
<img src="{IMGDIR}/rewardsmall.gif" alt="{lang thread_reward}" />
<!--{elseif $thread['price'] < 0}-->
<img src="{IMGDIR}/rewardsmallend.gif" alt="{lang thread_rewardend}" />
<!--{/if}-->
<!--{elseif $thread['special'] == 4}-->
<img src="{IMGDIR}/activitysmall.gif" alt="{lang thread_activity}" />
<!--{elseif $thread['special'] == 5}-->
<img src="{IMGDIR}/debatesmall.gif" alt="{lang thread_debate}" />
<!--{elseif $thread['special'] == 6}-->
<img src="{IMGDIR}/videosmall.gif" alt="{lang thread_video}" />
<!--{else}-->
$thread['icon']
<!--{/if}-->
</td>
<td class="forum"><a href="forumdisplay.php?fid=$thread[fid]">$thread[name]</a></td>
<th class="$thread[folder]" {if $forum['ismoderator']} ondblclick="ajaxget('modcp.php?action=editsubject&tid=$thread[tid]', 'thread_$thread[tid]', 'specialposts');doane(event);"{/if}>
<label>
<!--{if $thread['rate'] > 0}-->
<img src="{IMGDIR}/agree.gif" alt="" />
<!--{elseif $thread['rate'] < 0}-->
<img src="{IMGDIR}/disagree.gif" alt="" />
<!--{/if}-->
<!--{if in_array($thread['displayorder'], array(1, 2, 3))}-->
<img src="{IMGDIR}/pin_$thread[displayorder].gif" alt="$threadsticky[3-$thread[displayorder]]" />
<!--{/if}-->
<!--{if $thread['digest'] > 0}-->
<img src="{IMGDIR}/digest_$thread[digest].gif" alt="{lang thread_digest} $thread[digest]" />
<!--{/if}-->
</label>
$thread[typeid]
<span id="thread_$thread[tid]"><a href="viewthread.php?tid=$thread[tid]&extra=$extra"$thread[highlight]>$thread[subject]</a></span>
<!--{if $thread['readperm']}--> - [{lang readperm} <span class="bold">$thread[readperm]</span>]<!--{/if}-->
<!--{if $thread['price'] > 0}-->
<!--{if $thread['special'] == '3'}-->
- [{lang thread_reward}
<!--{else}-->
- [{lang price}
<!--{/if}-->
{$extcredits[$creditstrans][title]} <span class="bold">$thread[price]</span> {$extcredits[$creditstrans][unit]}]
<!--{elseif $thread['special'] == '3' && $thread['price'] < 0}-->
- [{lang reward_solved}]
<!--{/if}-->
<!--{if $thread['attachment']}-->
<img src="images/attachicons/common.gif" alt="{lang attachment}" class="attach" />
<!--{/if}-->
<!--{if $thread[multipage]}-->
<span class="threadpages">$thread[multipage]</span>
<!--{/if}-->
<!--{if $thread['new']}-->
<a href="redirect.php?tid=$thread[tid]&goto=newpost$highlight#newpost" class="new">New</a>
<!--{/if}-->
</th>
<td class="author">
<cite>
<!--{if $thread['authorid'] && $thread['author']}-->
<a href="space.php?uid=$thread[authorid]">$thread[author]</a>
<!--{else}-->
<!--{if $forum['ismoderator']}-->
<a href="space.php?uid=$thread[authorid]">{lang anonymous}</a>
<!--{else}-->
{lang anonymous}
<!--{/if}-->
<!--{/if}-->
</cite>
<em>$thread[dateline]</em>
</td>
<td class="nums"><strong>$thread[replies]</strong> / <em>$thread[views]</em></td>
<td class="lastpost">
<em><a href="{if $thread[digest] != -2}redirect.php?tid=$thread[tid]&goto=lastpost$highlight#lastpost{else}viewthread.php?tid=$thread[tid]&page={echo max(1, $thread[pages]);}{/if}">$thread[lastpost]</a></em>
<cite>{lang forum_lastpost_by} <!--{if $thread['lastposter']}--><a href="{if $thread[digest] != -2}space.php?username=$thread[lastposterenc]{else}viewthread.php?tid=$thread[tid]&page={echo max(1, $thread[pages]);}{/if}">$thread[lastposter]</a><!--{else}-->{lang anonymous}<!--{/if}--></cite>
</td>
</tr>
</tbody>
<!--{/loop}-->
</table>
</div>
</div>
使用方法
1,将c.php放到Discuz根目录下!
2,将c.htm放到templates\当前主体\下!(比如templates\default\)!
3,在xoops的相关页面(比如自定义区块中)下加入
<iframe border="0" marginwidth="1" marginheight="1" src="http://Discuz论坛地址/c.php" frameborder="0" width="850" height="435" scrolling="no"></iframe>
其中,宽高自定义!
请教你一个问题:在使用 coolcode 插件时,我也能成功显示,但是我的文章发布后 再想修改什么地方的时候,编辑器里面的coolcode 都是打乱的,代码也打乱了。怎么办,这时候要是直接保存,coolcode就失效了! 你是这样的么?
您下载 http://www.cnxct.com/wp-content/uploads/2007/12/coolcode34.rar 这个试试,
详情见这里:http://www.cnxct.com/cnxct/129
哦 我下载了,请问有什么区别么
支持怎么调用的?
我的编辑器老实自动添加比如这样的标志,当然 他总是把coolcode和 直接靠近,中间什么都没有
我的编辑器老实自动添加比如《p》《/p》这样的标志,当然 他总是把coolcode和 直接靠近,中间什么都没有
呵呵,我都是使用 “html源代码”模式进行编辑的,你别用”可视化”的那个试试,具体什么情况,我也没懂你的意思!!
PS.你的blog的logo做的好酷啊! 就是这个图http://photo1.9you.com/pic/userphoto/37/71/2037233771/wxpg1225862854.gif
看的头都大了