Interspire Product Knowledge Base

Would you like to...

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favorites Add to favorites

Remove Highlighting Remove Highlighting

Edit this Article

Export to PDF

User Opinions (1 vote)

100% thumbs up 0% thumbs down

How would you rate this answer?



Thank you for rating this answer.

How do I display the number of comments for an article in an article list such as Recent Articles?

This applies to ArticleLive NX 1.7 and above

For article lists like Recent Articles and Featured Articles, there's only 2 small modifications you need to make in 2 different files for the comments to be displayed.

Firstly, you need to find the number of comments to display. If you open your /admin/includes/classes/class.helper.php file and find the GetArticles() function, add the below code directly after the line beginning with $GLOBALS['imgpath']

For Interspire Website Publisher NX 2.0 and above you need to use the GetArticleList() function in the /includes/classes/class.article.php file. Place this code at the top of the function.

$GLOBALS['HideComments'] = '';
if($articleRow["Type"] != 1) {
    $GLOBALS['HideComments'] = 'none';
}

$query = sprintf("SELECT COUNT(*) as co FROM %scomments WHERE ContentID=%d AND Details!=''", $GLOBALS["AL_CFG"]["tablePrefix"], $articleRow["ArticleID"]);
$query = $GLOBALS["AL_DB"]->Query($query);

$commCount = $GLOBALS["AL_DB"]->Fetch($query);
$GLOBALS["NumComments"] = $commCount["co"];
$GLOBALS["AL_DB"]->FreeResult($query);

Then, you need to be able to display the comments in the list. We'll place it with the bottom links, such as Full Article and Printer Version.


For NX 1.7: Open the ArticleList.html Snippet file (/templates/{your template}/Panels/Snippets/ArticleList.html) and add the code below directly before %%SNIPPET_ArticleEditButton%%

For NX 2.0: Open one of the 'ArticleList' snippets (e.g. ArticleList_featured.html for the Featured Articles list) which are located  in the /templates/{your template}/Panels/Snippets/ folder and add the code below directly before %%SNIPPET_ArticleEditButton%%

<li class="Comments" style='display:%%GLOBAL_HideComments%%'><a href='%%GLOBAL_url%%'>Comments: %%GLOBAL_NumComments%%</a></li>
You can then add a style in the styles.css file for that Comments class, to add a small image or anything else to fit with the other links.

Related Articles

No related articles were found.

Attachments

No attachments were found.

Powered by Interspire Knowledge Manager - World's #1 Best Selling FAQ and Knowledge Base Software