16-Feb-2014, 12:27 PM
Hi. I'm preparing to use commentics on a website where I need to display the comment count under multiple articles (on the same page: Main page [ links to multiple other pages and comment counts next to each of these pages] ).
Here's what I do:
<?php
$id = "1"; //The ID of the page. You can get this from Manage -> Pages.
require_once ($_SERVER['DOCUMENT_ROOT'].'comments/includes/db/connect.php');
$query = mysql_query("SELECT * FROM `".$cmtx_mysql_table_prefix."comments` WHERE is_approved = '1' AND page_id = '$id'");
$total = mysql_num_rows($query);
echo $total;
?>
It returns the count perfectly UNTIL the point where the comment form of the main page (the one that is used for these other links and for it's own content) is added.
<?php
$cmtx_page_id = '5';
$cmtx_reference = 'some page';
$cmtx_path = ($_SERVER['DOCUMENT_ROOT'].'comments/');
define('IN_COMMENTICS', 'true'); //no need to edit this line
require $cmtx_path . 'includes/commentics.php'; //no need to edit this line
?>
Then nothing is returned. I'm not very PHP savvy so I can just guess what's happening, but my guesses did not help so far...
Once again:
Main page----------------------------
some link with a comment count PHP code
some another link with a comment count PHP code
Commentics FORM PHP code
one more link with a comment count PHP code (but this time it doesn't return any value)
End of main page--------------------------
Do you have any idea of what's happening?
Here's what I do:
<?php
$id = "1"; //The ID of the page. You can get this from Manage -> Pages.
require_once ($_SERVER['DOCUMENT_ROOT'].'comments/includes/db/connect.php');
$query = mysql_query("SELECT * FROM `".$cmtx_mysql_table_prefix."comments` WHERE is_approved = '1' AND page_id = '$id'");
$total = mysql_num_rows($query);
echo $total;
?>
It returns the count perfectly UNTIL the point where the comment form of the main page (the one that is used for these other links and for it's own content) is added.
<?php
$cmtx_page_id = '5';
$cmtx_reference = 'some page';
$cmtx_path = ($_SERVER['DOCUMENT_ROOT'].'comments/');
define('IN_COMMENTICS', 'true'); //no need to edit this line
require $cmtx_path . 'includes/commentics.php'; //no need to edit this line
?>
Then nothing is returned. I'm not very PHP savvy so I can just guess what's happening, but my guesses did not help so far...
Once again:
Main page----------------------------
some link with a comment count PHP code
some another link with a comment count PHP code
Commentics FORM PHP code
one more link with a comment count PHP code (but this time it doesn't return any value)
End of main page--------------------------
Do you have any idea of what's happening?