因为 我静态模板 调用的 代码 是 : $sorttemplate['body'] ,这个函数是调用分类信息模板的列表页。
而处理 $sorttemplate['body'] 这个代码的文件就在 function_threadsort.php 这个文件里,
处理的函数如下:
------------------------------------------------------------------------------------------------------------------------------------
function showsortmodetemplate($sortid, $fid, $sortoptionarray, $templatearray, $threadlist, $threadids = array(), &$verify = array()) {
global $_G;
$sorttemplate = $replaces = array();
$sorttemplate['footer'] = $sorttemplate['body'] = $sorttemplate['header'] = '';
if(strexists($templatearray[$sortid], '[loop]') && strexists($templatearray[$sortid], '[/loop]')) {
preg_match('/^(.+?)\[loop\](.+?)\[\/loop\](.+?)$/s', $templatearray[$sortid], $r);
$sorttemplate['header'] = stripslashes($r[1]);
$templatearray[$sortid] = stripslashes($r[2]);
$sorttemplate['footer'] = stripslashes($r[3]);
}
$rewritespace = is_array($_G['setting']['rewritestatus']) && in_array('home_space', $_G['setting']['rewritestatus']);
$rewriteviewthread = is_array($_G['setting']['rewritestatus']) && in_array('forum_viewthread', $_G['setting']['rewritestatus']);
$sortlistarray = showsorttemplate($sortid, $fid, $sortoptionarray, $templatearray, $threadlist, $threadids, true);
foreach($threadlist as $thread) {
foreach($thread as $k => $v) {
$replaces['{'.$k.'}'] = $v;
}
$body = $sortlistarray['template'][$sortid][$thread['tid']];
$replaces['{author_url}'] = $rewritespace ? rewriteoutput('home_space', 1, '', $thread['authorid']) : 'home.php?mod=space&uid='.$thread['authorid'];
$replaces['{lastposter_url}'] = $rewritespace ? rewriteoutput('home_space', 1, '', '', $thread['lastposter']) : 'home.php?mod=space&username='.$thread['lastposterenc'];
$replaces['{subject_url}'] = $rewriteviewthread ? rewriteoutput('forum_viewthread', 1, '', $thread['tid']) : 'forum.php?mod=viewthread&tid='.$thread['tid'];
$replaces['{lastpost_url}'] = 'forum.php?mod=redirect&tid='.$thread['tid'].'&goto=lastpost#lastpost';
$replaces['{lastpost_url}'] = 'forum.php?mod=redirect&tid='.$thread['tid'].'&goto=lastpost#lastpost';
$replaces['{avatar_small}'] = avatar($thread['authorid'], 'small', true);
$replaces['{typename_url}'] = 'forum.php?mod=forumdisplay&fid='.$fid.'&filter=typeid&typeid='.$thread['tid'];
$replaces['{attachment}'] = ($thread['attachment'] == 2 ? '<img src="'.STATICURL.'image/filetype/image_s.gif" align="absmiddle" />' :
($thread['attachment'] == 1 ? '<img src="'.STATICURL.'image/filetype/common.gif" align="absmiddle" />' : ''));
$replaces['{author_verify}'] = $verify[$thread['authorid']] ? $verify[$thread['authorid']] : '';
if($_G['forum']['ismoderator']) {
if($thread['fid'] == $fid && $thread['displayorder'] <= 3 || $_G['adminid'] == 1) {
$replaces['{modcheck}'] = '<input onclick="tmodclick(this)" type="checkbox" name="moderate[]" value="'.$thread['tid'].'" />';
} else {
$replaces['{modcheck}'] = '<input type="checkbox" disabled="disabled" />';
}
} else {
$replaces['{modcheck}'] = '';
}
$body = str_replace(array_keys($replaces), $replaces, $body);
$sorttemplate['body'] .= $body;
}
return $sorttemplate;
} |