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?
- Paustian responded to »Different page content under one template (tpl file) based on URL« 06:46 AM
- Guite responded to »Remove contents of nuke_sc_anticracker from Database« 01:30 AM
- espaan responded to »Categories disappear when editing ...« 08. Feb
- eledril responded to »How decrease zikula cpu usage« 08. Feb
- jmvaughn responded to »PN 0.764 to Zikula 1.1.2 (migration) Internal Server Error« 08. Feb
- eledril created topic »Where can I download BBCode and BBSmile?« 08. Feb
- Paustian responded to »Need Feedback« 08. Feb
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
EZComments in Top List
-
- Rank: Freshman
- Registered: Sep 28, 2004
- Last visit: Oct 21, 2009
- Posts: 92
-
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
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: Freshman
- Registered: Sep 28, 2004
- Last visit: Oct 21, 2009
- Posts: 92
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: Freshman
- Registered: Sep 28, 2004
- Last visit: Oct 21, 2009
- Posts: 92
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: Helper
- Registered: Jan 12, 2004
- Last visit: Jan 20, 2010
- Posts: 590
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
Users on-line
This list is based on users active over the last 60 minutes.
