Help - Search - Members - Calendar
Full Version: Entry list by "most popular"
Movable Type Community Forum > Additional Resources > Tips and Tricks
myaimistrue
I want to put a list in the sidebar of my archives page called "most popular" and list the top 10 entries by number of comments left...

anyone know the code to do this?

Amber@myaimistrue.com
almuhajabah
If you can run PHP on your server, try the entries with the most comments script.
kadyellebee
There's also the commentleader plugin smile.gif

Kristine
hlb
You should install the SQL Plugin first, and use the code below:
CODE
<MTSQLEntries query="SELECT e.entry_id AS entry_id, count(*) AS count FROM mt_entry AS e, mt_comment AS c WHERE e.entry_id = c.comment_entry_id AND entry_blog_id=YOUR_BLOG_ID GROUP BY c.comment_entry_id ORDER BY count DESC LIMIT 10">
<a href="<MTEntryLink>"><MTEntryTitle></a> (<$MTEntryCommentCount$>)<br />
</MTSQLEntries>

You should assign your blog_id(YOUR_BLOG_ID) to gain the correct result with the LIMIT option. Here is the result (notice: it contains Chinese characters). smile.gif
myaimistrue
I can't run PHP on my server, and when I try the SQL thing, it gives me an error saying I can only use the MTSQL tag with a SQL capable datastore.

Help? Is there a more automatic way to do this with MT?
redshifter
*bump*

anyone know if MT can do this natively?
girlie
Did you try the CommentLeaders plugin that Kristine linked to??

If MT could do it natively, these other methods wouldn't have been necessary. smile.gif
ifenn
hlb,

That's a great bit of sql! Any idea how it can be amended to only look at entries within a particular category when used in a category archive?

All the best,

--
Ian
losmadden
QUOTE
Any idea how it can be amended to only look at entries within a particular category when used in a category archive?


I have the same question. Anybody done this? Thanks.
forsv
QUOTE (almuhajabah @ May 30 2003, 08:16 PM)
If you can run PHP on your server, try the entries with the most comments script.

I do not have php or access to SQL on mblog where myu blog is . I need the plugin in java script. Please help.
TweezerMan
See reply in other forum thread you posted to.
KCDTX
Fanblogs does this by calling the MySQL and then weighing those by the age of the post. It's fuzzy math, but a newer post with 20 comments might be "hotter" than an old post with 99 comments. Does that make sense. Anyway, I've got the code if it's what you're looking for.
hypergriso
QUOTE (hlb @ May 31 2003, 02:47 PM) *
You should install the SQL Plugin first, and use the code below:
CODE
<MTSQLEntries query="SELECT e.entry_id AS entry_id, count(*) AS count FROM mt_entry AS e, mt_comment AS c WHERE e.entry_id = c.comment_entry_id AND entry_blog_id=YOUR_BLOG_ID GROUP BY c.comment_entry_id ORDER BY count DESC LIMIT 10">
<a href="<MTEntryLink>"><MTEntryTitle></a> (<$MTEntryCommentCount$>)<br />
</MTSQLEntries>

You should assign your blog_id(YOUR_BLOG_ID) to gain the correct result with the LIMIT option. Here is the result (notice: it contains Chinese characters). smile.gif


I'm using it and it works but it doesn't sort exactly by count desc. someone knows why?

This is the list I get:

Cos'è "una mamma"... (2)
PAPPA – alimenta... (25)
Donne e lavoro: la... (5)
BABY SITTER, ASILO... (8)
Sarò madre e me n... (8)
“FATE LA NANNA�... (7)
26 maggio Festa de... (6)
Apprensioni e paur... (5)
Libro sull'educazi... (6)
Coliche gassose: c... (5)

probably thosa are the 10 most commented but they are unsorted....

thank you
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.