VAHID216
مدیر بازنشسته
برای اینکه بتونید آخرین پست ها رو در صفحه اصلی انجمنتون نشون بدید کافیه کار های زیر رو انجام بدید:
1- ابتدا فایل زیر رو طبق آدرس زیر باز کنید :
بعد به دنبال عبارت زیر بگردید
سپس خط زیر را در زیر آن اضافه کنید
سپس در انتهای همین فایل کد های زیر را بیابید :
حالا قبل از کدهایی که در مرحله قبل در انتهای فایل پیدا کردید این کد ها رو قرار بدید:
همش همین موفق باشید
1- ابتدا فایل زیر رو طبق آدرس زیر باز کنید :
کد:
sources/boards.php
کد:
$this->output .= $this->html->PageTop( $std->get_date( $ibforums->input['last_visit'], 'LONG' ) );
کد:
$this->output .= $this->show_latestposts();
کد:
}
?>
کد:
/*-------------------------------------------------------------------------*/
// Latest Posts, written by ntd1712
/*-------------------------------------------------------------------------*/
function show_latestposts()
{
global $ibforums, $DB, $std, $print, $forums;
$html = "";
$good_forum = array();
$bad_forum = array();
$read_array = array();
$new_posts = 0;
foreach( $forums->forum_by_id as $id => $f )
{
if ( ($std->check_perms($f['read_perms']) != TRUE) or ($f['password'] != "" ) )
{
$this->bad_forum[] = $f['id'];
} else {
$this->good_forum[] = $f['id'];
}
}
if ( count($this->good_forum) > 0 )
{
$qe = "forum_id IN(".implode(',', $this->good_forum ).") AND ";
}
if ( $read = $std->my_getcookie('topicsread') )
{
$read_array = unserialize(stripslashes($read));
if ( ! is_array($read_array) )
{
$read_array = array();
}
}
$collapsed_ids = ','.$std->my_getcookie('collapseprefs').',';
$show['div_fo'] = 'show';
$show['div_fc'] = 'none';
if ( strstr( $collapsed_ids, ',lpost,' ) )
{
$show['div_fo'] = 'none';
$show['div_fc'] = 'show';
}
$html .= "<div class='borderwrap' style='display:{$show['div_fc']}' id='fc_lpost'>
<div class='maintitle'>
<p class='expand'><a href=\"java script:togglecategory('lpost', 0);\"><{E_PLUS}></a></p>
<p><{CAT_IMG}> 5 Latest Posts</p>
</div>
</div>";
$html .= "<div class='borderwrap' style='display:{$show['div_fo']}' id='fo_lpost'>
<div class='maintitle'>
<p class='expand'><a href=\"java script:togglecategory('lpost', 1);\"><{E_MINUS}></a></p>
<p><{CAT_IMG}> 5 Latest Posts</p>
</div>
<table cellspacing='1'>
<tr>
<th width='65%' colspan='2'>{$ibforums->lang['topics']}</th>
<th width='7%' align='center' nowrap='nowrap'>Views</th>
<th width='7%' align='center' nowrap='nowrap'>{$ibforums->lang['replies']}</th>
<th width='35%'>{$ibforums->lang['last_post_info']}</th>
</tr>";
$DB->simple_construct( array( 'select' => 't.tid, t.title, t.posts, t.starter_id, t.start_date, t.last_poster_id, t.last_post, t.starter_name, t.last_poster_name, t.views, t.forum_id, r.*',
'from' => "topics t LEFT JOIN ".SQL_PREFIX."topics_read r ON(r.read_tid=t.tid AND r.read_mid=".$ibforums->member['id'].")",
'where' => "$qe approved=1 and state != 'closed' and (moved_to is null or moved_to = '')",
'order' => 'start_date DESC',
'limit' => array( 0, 5 ) ) );
$DB->simple_exec();
while ( $row = $DB->fetch_row() )
{
$data = array( 'tid' => $row['tid'],
'topic' => $row['title'],
'starter' => $ibforums->lang['by'] . ": " . $std->make_profile_link( $row['starter_name'], $row['starter_id']),
'replies' => $std->do_number_format( intval($row['posts']) ),
'views' => $std->do_number_format( intval($row['views']) ),
'last_post' => $std->get_date($row['last_post'], 'LONG'),
'last_poster' => $ibforums->lang['by'] . ": " . $std->make_profile_link( $row['last_poster_name'], $row['last_poster_id']),
);
$last_time = 0;
if ( $ibforums->member['id'] and $ibforums->vars['db_topic_read_cutoff'] AND ($row['last_post'] > intval($ibforums->forum_read[ $row['forum_id'] ])) )
{
$db_topic_read_cutoff = time() - $ibforums->vars['db_topic_read_cutoff'] * 86400;
if ( $row['last_post'] > $db_topic_read_cutoff )
{
if ($row['read_date'])
{
$last_time = intval( $row['read_date'] );
}
else
{
$last_time = 1;
}
}
}
if ( ! $last_time )
{
$last_time = ($read_array[$row['tid']] > $ibforums->input['last_visit']) ? $read_array[$row['tid']] : $ibforums->input['last_visit'];
if ( $ibforums->forum_read[$row['forum_id']] > $last_time )
{
$last_time = $ibforums->forum_read[$row['forum_id']];
}
}
if ($last_time && ($row['last_post'] > $last_time))
{
$new_posts++;
$data['go_new_post'] = "<a href='{$ibforums->base_url}showtopic={$data['tid']}&view=getnewpost'><{NEW_POST}></a>";
$data['icon_topic'] = "<{C_ON}>";
}
else
{
$data['go_new_post'] = "";
$data['icon_topic'] = "<{C_OFF}>";
}
if ( $data['topic'] )
{
$data['topic'] = strip_tags($data['topic']);
$data['topic'] = str_replace( "!" , "!" , $data['topic'] );
$data['topic'] = str_replace( """, "\"", $data['topic'] );
}
$html .= "<tr>
<td class='row2' onMouseOver='hiliteOver(this);' onMouseOut='hiliteOut(this);' valign='middle' width='1%'>{$data['icon_topic']}</td>
<td class='row2' onMouseOver='hiliteOver(this);' onMouseOut='hiliteOut(this);' valign='middle'>{$data['go_new_post']}<a href='{$ibforums->base_url}showtopic={$data['tid']}'>{$data['topic']}</a><br /><span class='lastaction'>{$data['starter']}</span></td>
<td class='row1' onMouseOver='hiliteOver1(this);' onMouseOut='hiliteOut1(this);' align='center'>{$data['views']}</td>
<td class='row1' onMouseOver='hiliteOver1(this);' onMouseOut='hiliteOut1(this);' align='center'>{$data['replies']}</td>
<td class='row1' onMouseOver='hiliteOver1(this);' onMouseOut='hiliteOut1(this);'><a href='{$ibforums->base_url}showtopic={$data['tid']}&view=getlastpost' title='{$ibforums->lang['tt_golast']}'><{LAST_POST}></a> {$data['last_post']}<br /><span class='lastaction'>{$data['last_poster']}</span></td>
</tr>";
}
$html .= "</table></div><br />";
return $html;
}