Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
[BLOCK] Last Comments Block
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2 Only Mods Complete

Unknown User
2009-01-28 18:10:53
Make a block with this code:

<?

begin_block("Last Comments");

$res = mysql_query("SELECT * FROM torrents ORDER BY added DESC LIMIT 10") or die(mysql_error()); //Change the 10 to the number of torrents you want to display.

$arr = mysql_fetch_array($res);

while ($arr = mysql_fetch_assoc($res))

{

//////Cut Name///////////////

$char1 = 20; //cut name length change to the number of chars you want to display

$smallname = CutName(htmlspecialchars($arr["name"]), $char1);

$dispname = "<b>".$smallname."</b>";

////////////////////////////

$torid = $arr['id'];

$tornname = $arr['name'];

$visites = $arr['hits'];



$q = mysql_query("SELECT COUNT(*) FROM comments WHERE torrent=$torid") or die(mysql_error());

$r = mysql_fetch_row($q);

$numcomments = $r[0];





?>

<table width="100%" border="0">

 <tr>

<td><div align="center"><b><?=$dispname?></b></div></td>

  </tr>

  <tr>

<td><div align="center"><font color="#009900">[Comments: <? echo "<a href=torrents-details.php?id=$torid&hit=1>$numcomments</a>";?>]</font></div></td>

</tr>

<tr>

<td><div align="center"><font color="#FF0000">[Hits: <?=$visites?>]</font></div></td>

 </tr>

</table>

<?

}

end_block();

?>
Unknown User
2009-01-28 21:24:18
Thanks...This mod works nice....Many thanks:)
Unknown User
2009-01-29 03:50:41
thank you very much !!!

:D
Unknown User
2009-01-29 04:25:44
for those who prefer that the link is in the torrent name him make these changes.

change:

 <td><div align="center"><b><?=$dispname?></b></div></td>
By:


<td><div align="center"><b><? echo "<a href=torrents-details.php?id=$torid>$dispname</a>";?></b></div></td>





change:



<td><div align="center"><font color="#009900">[Comments: <? echo "<a href=torrents-details.php?id=$torid

hit=1>$numcomments</a>";?>]</font></div></td>





By:



<td><div align="center"><font color="green">[Comments: <?=$numcomments?>]</font></div></td>



I am happy to know that there are people seeking to help the other members, as nigthmare ... I think it is always good new ideas arise and anyone can perform.

Great work nigthmare.

Hugs to all.
Unknown User
2009-01-30 15:46:46
Hi people!

I have tried to write itself this block because author's me did not arrange. Took for a basis a code from admincp and here that has turned out:

<?

begin_block("Last Comment");

$res = mysql_query("SELECT COUNT(*) FROM comments WHERE torrent > '0'") or die(mysql_error());

$arr = mysql_fetch_row($res);

$count = $arr[0];

$char=50;



list($pagertop, $pagerbottom, $limit) = pager(3, $count, "admincp.php?action=lastcomm&");



$res = mysql_query("SELECT comments.id, comments.added, comments.user, comments.torrent, comments.text, torrents.name as tnome, users.username as unome FROM comments LEFT JOIN users ON users.id = comments.user LEFT JOIN torrents ON torrents.id = comments.torrent ORDER BY comments.id DESC $limit") or die(mysql_error());



while ($arr = mysql_fetch_assoc($res)) {

$userid = $arr["user"];

$username = $arr["unome"];

$data = date("d-m-Y \\a\\t H:i:s", utc_to_tz_time($arr['added']));

$tid = $arr["torrent"];

$comentario = stripslashes(format_comment($arr["text"]));

////Cut Comment///

$smallcomm = CutName($comentario, $char);

////Display Comment///

echo "<a href=\"torrents-details.php?id=$tid\">".$smallcomm."</a><br>????????? <B>".$data."</B> by <a href=\"account-details.php?id=".$userid."\">".$username."</a><br><hr>";



}



end_block();

?>


screenshot:



p.s. The only thing that I couldn't make it to optimise a code of mysql query. Maybe somebody can help?

p.p.s. sorry if my english is bad. =)
Unknown User
2009-01-31 12:34:20
nightmare:

with your code, appear torrents with 0 comments... how can i fix it?

thank you for your code.
Unknown User
2009-01-31 13:00:51
"flashmate, post: 52825":
nightmare:
with your code, appear torrents with 0 comments... how can i fix it?

thank you for your code.

try this. it has not been tested but may work.

<?

begin_block("Last Comments");

$res = mysql_query("SELECT * FROM torrents ORDER BY added DESC LIMIT 10") or die(mysql_error()); //Change the 10 to the number of torrents you want to display.

$arr = mysql_fetch_array($res);

while ($arr = mysql_fetch_assoc($res))

{

//////Cut Name///////////////

$char1 = 20; //cut name length change to the number of chars you want to display

$smallname = CutName(htmlspecialchars($arr["name"]), $char1);

$dispname = "<b>".$smallname."</b>";

////////////////////////////

$torid = $arr['id'];

$tornname = $arr['name'];

$visites = $arr['hits'];



$q = mysql_query("SELECT COUNT(*) FROM comments WHERE torrent=$torid") or die(mysql_error());

$r = mysql_fetch_row($q);

$numcomments = $r[0];

if ($numcomments > 0) {

?>

<table width="100%" border="0">

 <tr>

<td><div align="center"><b><?=$dispname?></b></div></td>

  </tr>

  <tr>

<td><div align="center"><font color="#009900">[Comments: <? echo "<a href=torrents-details.php?id=$torid&hit=1>$numcomments</a>";?>]</font></div></td>

</tr>

<tr>

<td><div align="center"><font color="#FF0000">[Hits: <?=$visites?>]</font></div></td>

 </tr>

</table>

<?

}

}

end_block();

?>
Unknown User
2009-02-01 02:58:56
"walker1977, post: 52827":
try this. it has not been tested but may work.


<?

begin_block("Last Comments");

$res = mysql_query("SELECT * FROM torrents ORDER BY added DESC LIMIT 10") or die(mysql_error()); //Change the 10 to the number of torrents you want to display.

$arr = mysql_fetch_array($res);

while ($arr = mysql_fetch_assoc($res))

{

//////Cut Name///////////////

$char1 = 20; //cut name length change to the number of chars you want to display

$smallname = CutName(htmlspecialchars($arr["name"]), $char1);

$dispname = "<b>".$smallname."</b>";

////////////////////////////

$torid = $arr['id'];

$tornname = $arr['name'];

$visites = $arr['hits'];



$q = mysql_query("SELECT COUNT(*) FROM comments WHERE torrent=$torid") or die(mysql_error());

$r = mysql_fetch_row($q);

$numcomments = $r[0];

if ($numcomments > 0) {

?>

<table width="100%" border="0">

 <tr>

<td><div align="center"><b><?=$dispname?></b></div></td>

  </tr>

  <tr>

<td><div align="center"><font color="#009900">[Comments: <? echo "<a href=torrents-details.php?id=$torid&hit=1>$numcomments</a>";?>]</font></div></td>

</tr>

<tr>

<td><div align="center"><font color="#FF0000">[Hits: <?=$visites?>]</font></div></td>

 </tr>

</table>

<?

}

}

end_block();

?>


works fine, thank you. :D
Unknown User
2009-02-02 13:17:28
now, sometimes doesn't appear nothing on the block... :/
Unknown User
2010-12-03 22:44:53
Find:

$res = mysql_query("SELECT * FROM torrents ORDER BY added DESC LIMIT 10") or die(mysql_error());





and replace with:





$res = mysql_query("SELECT * FROM torrents WHERE comments>0 ORDER BY added DESC LIMIT 10") or die(mysql_error());
Unknown User
2011-08-22 11:20:59
Thank you :angry:
2024-05-14 15:49:22
Thanks.
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728