View Single Post
  #1  
Old 19th May 2013, 04:12
Giorgatzelos's Avatar
Giorgatzelos Giorgatzelos is offline
Senior Member
 
Join Date: Nov 2009
Greece
Posts: 300
Default index.php news mod help...
in my index.php i found this code that is for news:

Code:
if ($welcome_message != ""){
OpenTable(_btsitenews, '726');
$welcome_message = format_comment($welcome_message);
parse_smiles($welcome_message);
echo "<table width=\"100%\"><tr><td>".$welcome_message."</td></tr></table>";
CloseTable();
}
and somewhere in here i found this code that is for news and joe completed it for someone else:

Code:
if ($welcome_message != ""){
OpenTable(_btsitenews, '726');
?>
<script type="text/javascript" language="JavaScript">
function togglen(nome) {
if(document.getElementById(nome).style.display=='none')
{
document.getElementById(nome).style.display = 'block';
document.getElementById(nome+"img").src="http://www.bvlist.com/images/collapse.png";
} else {
document.getElementById(nome).style.display = 'none';
document.getElementById(nome+"img").src="http://www.bvlist.com/images/expand.png";
}
}

</script>
<?php
//Getting number of news(posts)
$last_in = $user->lastlogin;
$title = array();
$topic_id = array();
$sql = "SELECT  id AS id, subject AS subject FROM torrent_forum_topics WHERE forumid='26' ORDER BY id DESC LIMIT 3;";
$res = $db->sql_query($sql) or btsqlerror($sql);
$count = $db->sql_numrows($res);
while ($row = $db->sql_fetchrow($res)) {
$title[] = $row['subject'];
$topic_id[] = $row['id'];
}
for ($i=0; $i<=$count; $i++)
{
if ($i > $count-1)break;
echo "<table width=\"100%\"><tr><td align=right frame=\"below\">";
$res = $db->sql_query("SELECT body, added FROM ".$db_prefix."_forum_posts WHERE topicid='".$topic_id[$i]."' ORDER BY added ASC LIMIT 1") or sqlerr(__FILE__, __LINE__);
$rowe = $db->sql_fetchrow($res);
$resa = $db->sql_query("SELECT count(id) AS posts FROM ".$db_prefix."_forum_posts WHERE topicid='".$topic_id[$i]."'") or sqlerr(__FILE__, __LINE__);
$rowa = $db->sql_fetchrow($resa);
$welcome_message =  format_comment($rowe['body']);
parse_smiles($welcome_message);
if (!$welcome_message == '' && sql_timestamp_to_unix_timestamp($rowe["added"]) >= sql_timestamp_to_unix_timestamp($last_in))
{
echo "<img src=./images/new_031.gif alt=New! border=0 >";
}
if($i == 0)$show = 'block';
else
$show = 'none';
if($i == 0)$img = 'collapse';
else
$img = 'expand';
$nid = $i+1;
echo "Added on: ".$rowe['added']."<br />Comments : ".($rowa['posts']-1)."</td></tr><tr><td><a href=/forums.php?action=viewtopic&topicid=".$topic_id[$i].">".$title[$i]."</a></td></tr><tr><td><a style=\"cursor: pointer;\" onClick=\"togglen('nn".$nid."');\"><img title=\"Expand item\" id=\"nn".$nid."img\" src=\"http://www.bvlist.com/images/".$img.".png\" width=\"11px\" height=\"8px\" alt=\"+\"></a><div id=\"nn".$nid."\" style=\"display: $show\"><h2>".$welcome_message."</h2></div></td></tr></table>\n";
}
CloseTable();}

but i get no news @ my index...
(for testing reasons i uploaded a torrent and made a new thread at the forum or even commented on another torrent but no news :-( )
Attached Thumbnails
19-5-2013 5-06-32 ??.png  
Reply With Quote