07-Nov-2012, 01:48 PM
Hello,
I tried the add-ons Recent Comments on my page :
http://www.colorear2000.com/example.php
But nothing appears !
Is the add-ons compatible with V2.2 ?
Code of my page :
Thanks
Eric
I tried the add-ons Recent Comments on my page :
http://www.colorear2000.com/example.php
But nothing appears !
Is the add-ons compatible with V2.2 ?
Code of my page :
Quote:<?php
session_start();
ob_start();
?>
<html>
<head>
<title>Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="comments/css/stylesheet.css"/>
</head>
<body>
<br/>
<?php
$cmtx_page_id = "1";
$cmtx_reference = "Page One";
$cmtx_path = "comments/";
define('IN_COMMENTICS', 'true'); //no need to edit this line
require $cmtx_path . "includes/commentics.php"; //no need to edit this line
?>
<br><br>
<?php
define('IN_COMMENTICS', '1');
require_once "comments/includes/db/connect.php";
// Start of 'Recent Comments' **********************************************************************************************
echo "<h3>Recent Comments</h3>";
$comments = mysql_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '1' ORDER BY `dated` DESC LIMIT 5");
while ($comment = mysql_fetch_array($comments)) {
$page_query = mysql_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '" . $comment["page_id"] . "'");
$page = mysql_fetch_assoc($page_query);
echo $comment["name"] . " on <a href='" . $page["url"] . "'>" . $page["reference"] . "</a> at " . date("g:ia (jS-M)", strtotime($comment["dated"]));
echo "<br/>";
}
// End of 'Recent Comments' ************************************************************************************************
echo "<p/>";
// Start of 'Most Commented' ***********************************************************************************************
echo "<h3>Most Commented</h3>";
$comments = mysql_query("SELECT `page_id`, COUNT(`page_id`) AS `total` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '1' GROUP BY `page_id` ORDER BY `total` DESC LIMIT 5");
while ($comment = mysql_fetch_assoc($comments)) {
$page_query = mysql_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '" . $comment["page_id"] . "'");
$page = mysql_fetch_assoc($page_query);
echo "<a href='" . $page["url"] . "'>" . $page["reference"] . "</a> (" . $comment["total"] . ")";
echo "<br/>";
}
// End of 'Most Commented' *************************************************************************************************
echo "<p/>";
// Start of 'Top Posters' **************************************************************************************************
echo "<h3>Top Posters</h3>";
$names = mysql_query("SELECT `name`, COUNT(`name`) AS `total` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '1' GROUP BY `name` ORDER BY `total` DESC LIMIT 5");
while ($name = mysql_fetch_assoc($names)) {
echo $name["name"] . " (" . $name["total"] . ")";
echo "<br/>";
}
// End of 'Top Posters' ****************************************************************************************************
echo "<p/>";
// Start of 'Best Rated' **************************************************************************************************
echo "<h3>Best Rated</h3>";
$comments = mysql_query("SELECT `page_id`, AVG(`rating`) AS `average` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '1' AND `rating` != '0' GROUP BY `page_id` ORDER BY `average` DESC LIMIT 5");
while ($comment = mysql_fetch_assoc($comments)) {
$average = round($comment["average"] / 0.5) * 0.5;
$page_query = mysql_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '" . $comment["page_id"] . "'");
$page = mysql_fetch_assoc($page_query);
echo "<a href='" . $page["url"] . "'>" . $page["reference"] . "</a> (" . $average . ")";
echo "<br/>";
}
// End of 'Best Rated' ****************************************************************************************************
?>
</body>
</html>
Thanks
Eric