I was wondering, is it very difficult to add the "most comented stories" in Top List if you use EZComments?
I haven't seen any implementation of it yet, but it is probably not that hard to accomplish...
Anybody already has this?
- shyra posted »MenuTree Mystery« 19:50h
- dks answered »include a file« 18:22h
- dks answered ».764 -> 1.1.1, Can't add new blocks« 17:33h
- craigh posted »PostCalendar 5.5.0RC1 needs testers and translators« 17:24h
- bartl answered »Upgrading 1.0.2 --> 1.1.1« 15:02h
- Charlie-otb answered »SafeHTML output filter and youtube« 10:02h
- dl7und answered »Adding an "About Us" page« 03:34h
Login
EZComments in Top List
-
-
- Rank: Moderator
- Registered: 19.03.02
- last visit: 27.06.09
- Posts: 7661
The top list module is currently hard-coded to look at certain tables. So it would require adding a section of code to the module for EZComments. I've not done it and, at the moment, have no time to look at this code..... But it shouldn't be *that* difficult....
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Helper
- Registered: 29.09.04
- last visit: 23.04.09
- Posts: 119
I see, in the modules/Top_List/index.php file I found:
Code
if (pnModAvailable('Comments')) {
/**
* Top 10 commented stories
*/
$column = &$pntable['stories_column'];
$myquery = "SELECT $column[sid], $column[title], $column[comments]
FROM $pntable[stories] ".$queryalang."
ORDER BY $column[comments] DESC";
$result =& $dbconn->SelectLimit($myquery,$top);
if (!$result->EOF) {
echo '<h2>'.$top.' '._COMMENTEDSTORIES.'</h2>'."\n";
$lugar=1;
while(list($sid, $title, $comments) = $result->fields) {
if($comments>0) {
if (empty($title)) {
$title = '- '._NOTITLE.' -';
}
echo " $lugar: <a href=\"index.php?name=News&file=article&sid=$sid\">" . pnVarPrepForDisplay(pnVarCensor($title)) . "</a> - (".pnVarPrepForDisplay($comments)." "._COMMENTS.")<br />\n";
$lugar++;
}
$result->MoveNext();
}
echo '<br />'."\n";
}
$result->Close();
}
I guess it's just a matter to adjust for EZComments fields. Mmmm :D -
- Rank: Helper
- Registered: 29.09.04
- last visit: 23.04.09
- Posts: 119
This is my first try; of course, it does not work (Don't even try!) But I hope I can find the errors and fix it:
Code
if (pnModAvailable('EZComments')) {
// Top 10 commented stories from EZComments
$column = &$pntable['stories_column'];
$column1 = &$pntable['ezcomments_column'];
$total = 0;
$myquery = "SELECT $column[sid], $column[title], count($column1[objectid]) AS $total
FROM $pntable[stories] ".$queryalang."
LEFT JOIN $pntable[ezcomments] ON $column[sid] = $column1[objectid]
GROUP BY $column1[objectid]
ORDER BY $total DESC";
$result =& $dbconn->SelectLimit($myquery,$top);
if (!$result->EOF) {
echo '<h2>'.$top.' '._COMMENTEDSTORIES.'</h2>'."\n";
$lugar=1;
while(list($sid, $title, $total) = $result->fields) {
if($total>0) {
if (empty($title)) {
$title = '- '._NOTITLE.' -';
}
echo " $lugar: <a href=\"index.php?name=News&file=article&sid=$sid\">" . pnVarPrepForDisplay(pnVarCensor($title)) . "</a> - (".pnVarPrepForDisplay($total)." "._COMMENTS.")<br />\n";
$lugar++;
}
$result->MoveNext();
}
echo '<br />'."\n";
}
$result->Close();
}
If anybody has suggestions, they will be greatly appreciated, since my knowledge of PostNuke is really low :( -
- Rank: Professional
- Registered: 13.01.04
- Posts: 637
first thing evident reading your code is that you need to add:
Code
pnModDBInfoLoad('EZComments');
But this line should be before calling pnDBGetTables(); or it will not works.
Also in your SQL query you should test no only that that $column[sid] = $column1[objectid] but also that the ezcomment item is for the News module.
maybe there are other problems, you will need some testing.
--
Visit my live reef aquarium.
My Amazon wish list.
- Moderated by :
- Support
