- 论坛徽章:
- 0
|
一个风格模板的问题大家帮忙看看能不能帮忙搞定
原帖地址http://www.discuz.net/forum.php? ... 6discuz_version%3D2此风格虽然作者发布了,但有一些问题,所以希望会PHP的朋友看一下,只需要能实现下面的数据调用的代码就可以了!
数据是直接从数据库调用的,但具体怎么调用就不知道 了,大家帮忙看看
//招聘信息首页调用
$hack_cut_str = 30; //标题字数
$hack_cut_strauthor = 9;
$hack_forumid = "52";//要显示的论坛的fid
$new_zhaopin_threadlist = array();
$zhaopinthread = array();
$query = $db->query("SELECT t.*, f.name, tt.name as typename FROM {$tablepre}threads t, {$tablepre}forums f,{$tablepre}threadtypes tt WHERE t.typeid=tt.typeid AND t.fid<>'$fid' AND f.fid=t.fid AND t.displayorder>=0 AND f.fid in($hack_forumid) ORDER BY t.dateline DESC LIMIT 0, 8");
while($zhaopinthread = $db->fetch_array($query)) {
$zhaopinthread['forumname'] = ereg_replace('<[^>]*>','',$zhaopinthread['name']);
$zhaopinthread['view_subject'] = cutstr($zhaopinthread['subject'],$hack_cut_str);
$zhaopinthread['view_author'] = cutstr($zhaopinthread['author'],$hack_cut_strauthor);
$zhaopinthread['date']= gmdate("$dateformat $timeformat", $zhaopinthread['dateline'] + $timeoffset * 3600);
$zhaopinthread['lastreplytime']= gmdate("$dateformat $timeformat", $zhaopinthread[lastpost] + ($timeoffset * 3600));
if($zhaopinthread['highlight']) {
$string = sprintf('%02d', $zhaopinthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$zhaopinthread['highlight'] = 'style="';
$zhaopinthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$zhaopinthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$zhaopinthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$zhaopinthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$zhaopinthread['highlight'] .= '"';
} else {
$zhaopinthread['highlight'] = '';
}
$new_zhaopin_threadlist[] = $zhaopinthread;
}
//招聘结束
这是根目录下index.php里的代码
<div class="news_show">
<div class="news_index">
<h3>招聘信息</h3>
<div class="news_list">
<!--{loop $new_zhaopin_threadlist $zhaopinthread}-->
<!--{if $zhaopinthread[replies]}-->
<li><a href="viewthread.php?tid=$zhaopinthread[tid]" $zhaopinthread['highlight']>$zhaopinthread[view_subject]</a></li>
<!--{else}-->
<li><a href="viewthread.php?tid=$zhaopinthread[tid]" $zhaopinthread['highlight']>$zhaopinthread[view_subject]</a></li>
<!--{/if}-->
<!--{/loop}-->
</div>
</div>
</div>
这是模版discuz.htm里的部份代码 |
|