PHP interesse |
|
Nope werkt ook nie...
<?
if($menu_pref['topics_show'] == "") {
$limit = 10;
} else {
$limit = $menu_pref['topics_show'];
}
$sql = mysql_query("SELECT DISTINCT thread_id, thread_name, thread_forum_id, thread_datestamp, thread_parent, thread_lastpost FROM ".MPREFIX."forum_t WHERE thread_active !=0 ORDER BY thread_id DESC LIMIT ".$limit."") or die(mysql_error());
if($menu_pref['letters'] == "") {
$letters = 15;
} else {
$letters = $menu_pref['letters'];
}
$text = "";
$text .= "<table border=0 cellpadding=3 cellspacing=3>";
//show new forum posts
while($list = mysql_fetch_array($sql)) {
if($list['thread_parent'] == 0) {
$date = create_date($list['thread_datestamp']);
if(strlen($list['thread_name']) < $letters) {
$titel = $list['thread_name'];
} else {
$titel = substr($list['thread_name'], 0, $letters);
$titel .= "..";
}
} else {
$sql2 = mysql_query("SELECT DISTINCT thread_id, thread_name, thread_forum_id, thread_datestamp, thread_parent, thread_lastpost FROM ".MPREFIX."forum_t WHERE thread_id='".$list['thread_parent']."'") or die(mysql_error());
$row = mysql_fetch_array($sql2);
$date = create_date($list['thread_lastpost']);
if(strlen($row['thread_name']) < $letters) {
$titel = $row['thread_name'];
} else {
$titel = substr($row['thread_name'], 0, $letters);
$titel .= "..";
}
}
if($list['thread_parent'] == 0) {
$text .= "
<tr>
<td width='30%'><a href='".e_BASE."forum_viewtopic.php?".$list['thread_forum_id'].".".$list['thread_id']."' title='".$row['thread_name']."'><img src='".THEME."images/bullet2.gif' alt='' border=0 /> ".$date."</a></td>
<td width='70%'><a href='".e_BASE."forum_viewtopic.php?".$list['thread_forum_id'].".".$list['thread_id']."' title='".$row['thread_name']."'>".$titel."</a></td>
</tr>";
} else {
$text .= "
<tr>
<td width='30%'><a href='".e_BASE."forum_viewtopic.php?".$list['thread_forum_id'].".".$row['thread_id']."#".$list['thread_id']."' title='".$row['thread_name']."'><img src='".THEME."images/bullet2.gif' alt='' border=0 /> ".$date."</a></td>
<td width='70%'><a href='".e_BASE."forum_viewtopic.php?".$list['thread_forum_id'].".".$row['thread_id']."#".$list['thread_id']."' title='".$row['thread_name']."'>".$titel."</a></td>
</tr>";
}
}
$text .= "</table>";
$ns -> tablerender($menu_pref['forum_caption'], $text);
function create_date($datestamp){
global $pref;
$datestamp += (TIMEOFFSET*3600);
return strftime("%H:%M", $datestamp);
}
?>
<? if($menu_pref['topics_show'] == "") { $limit = 10; } else { $limit = $menu_pref['topics_show']; } $sql = mysql_query("SELECT DISTINCT thread_id, thread_name, thread_forum_id, thread_datestamp, thread_parent, thread_lastpost FROM ".MPREFIX ."forum_t WHERE thread_active !=0 ORDER BY thread_id DESC LIMIT ".$limit."") or die(mysql_error()); if($menu_pref['letters'] == "") { $letters = 15; } else { $letters = $menu_pref['letters']; } $text = ""; $text .= "<table border=0 cellpadding=3 cellspacing=3>"; //show new forum posts if($list['thread_parent'] == 0) { $date = create_date($list['thread_datestamp']); if(strlen($list['thread_name']) < $letters) { $titel = $list['thread_name']; } else { $titel = substr($list['thread_name'], 0, $letters); $titel .= ".."; } } else { $sql2 = mysql_query("SELECT DISTINCT thread_id, thread_name, thread_forum_id, thread_datestamp, thread_parent, thread_lastpost FROM ".MPREFIX ."forum_t WHERE thread_id='".$list['thread_parent']."'") or die(mysql_error()); $date = create_date($list['thread_lastpost']); if(strlen($row['thread_name']) < $letters) { $titel = $row['thread_name']; } else { $titel = substr($row['thread_name'], 0, $letters); $titel .= ".."; } } if($list['thread_parent'] == 0) { $text .= " <tr> <td width='30%'><a href='".e_BASE."forum_viewtopic.php?".$list['thread_forum_id'].".".$list['thread_id']."' title='".$row['thread_name']."'><img src='".THEME."images/bullet2.gif' alt='' border=0 /> ".$date."</a></td> <td width='70%'><a href='".e_BASE."forum_viewtopic.php?".$list['thread_forum_id'].".".$list['thread_id']."' title='".$row['thread_name']."'>".$titel."</a></td> </tr>"; } else { $text .= " <tr> <td width='30%'><a href='".e_BASE."forum_viewtopic.php?".$list['thread_forum_id'].".".$row['thread_id']."#".$list['thread_id']."' title='".$row['thread_name']."'><img src='".THEME."images/bullet2.gif' alt='' border=0 /> ".$date."</a></td> <td width='70%'><a href='".e_BASE."forum_viewtopic.php?".$list['thread_forum_id'].".".$row['thread_id']."#".$list['thread_id']."' title='".$row['thread_name']."'>".$titel."</a></td> </tr>"; } } $text .= "</table>"; $ns -> tablerender($menu_pref['forum_caption'], $text); function create_date($datestamp){ $datestamp += (TIMEOFFSET*3600); } ?>
|