ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

"Most Recent Comments" display on public template?

July 08, 2009 6:09pm

Subscribe [4]
  • #1 / Jul 08, 2009 6:09pm

    Tony Gravett

    34 posts

    I am trying to reproduce the “Most Recent Comments” listing as seen on the CP home page, using this code:

    <ul>
    {exp:weblog:entries weblog="{my_weblog}" orderby="most_recent_comment" sort="desc" rdf="off" dynamic="off" limit="10" disable="pagination|categories|trackbacks"}
        <li><a href="http://{homepage}search/detail/{entry_id}">{title}</a></li>
    {/exp:weblog:entries}
    </ul>

    This is not displaying the most recent comments, and I can’t understand the logic by which it is displaying them.  Should I be using a variant of the Comment Entries Tag?

    Thanks for any pointers ... this one is a repeat posting (no response the first time out).

    Mod Edit: Moved to the Technical Support Forum

  • #2 / Jul 08, 2009 7:50pm

    Greg Aker

    6022 posts

    Tony:
    Are you simply trying to display the comments, and not associated weblog entries?  If so, use the comment:entries loop and order by date.

    -greg

  • #3 / Jul 08, 2009 8:44pm

    Tony Gravett

    34 posts

    No, I’m trying to display a “Top Ten” list of entry titles (linked to their entry pages by {entry_id}) that have the latest user comments.

    I am getting close with the {exp:latest_comments} plug-in, but this does not support {entry_id} or custom weblog fields (I use a {sub_title} field, for instance).

    I just posted there to see if MeanStudios can help; otherwise, I am not sure how to pull these fields in.

  • #4 / Jul 09, 2009 2:21am

    John Henry Donovan

    12339 posts

    Tony,

    This is not displaying the most recent comments, and I can’t understand the logic by which it is displaying them.

    Using the parameter orderby=“most_recent_comment” will literally order your entries by which one was last commented on. It wont show the comments only the entry details.

    <ul>
    {exp:weblog:entries weblog="{my_weblog}" orderby="most_recent_comment" sort="desc" rdf="off" dynamic="off" limit="10" disable="pagination|categories|trackbacks"}
    <li>
           <a href="http://{homepage}search/detail/{entry_id}">{title}</a>
           {if sub_title != ""}
    <span class="sub_title">{sub_title}</span>{/if}
        </li>
    {/exp:weblog:entries}
    </ul>


    If you want to just display a list of the most recent comments with a link to the relevant weblog entry then use the comment:entries tags

    <ul>
    {exp:comment:entries weblog="{my_weblog}" sort="desc" orderby="date" limit="4" dynamic="off"}
      <li>
           <a href="http://{comment_entry_id_auto_path}">{title}</a>
           <strong>By {name} on {comment_date format="%d/%m/%Y"}</strong>
    
    {comment}
    
      </li>
    {/exp:comment:entries}
        </ul>

    Does that make things clearer?

  • #5 / Jul 09, 2009 12:15pm

    Tony Gravett

    34 posts

    John wrote:

    Using the parameter orderby=“most_recent_comment” will literally order your entries by which one was last commented on. It wont show the comments only the entry details.

    Thanks for the {exp:comment:entries} code example.  I am actually trying to display a list of entry titles (linked to their respective entry pages using their entry_ids) that contain the most recent comment *activity*—I don’t need to show the actual comments, or the comment’s author.

    If I use your code, removing the comment and author, I get close, but entries with more than one recent comment get listed more than once—again, I want the list to be of the ten _different_ (unique) entries with the most recent comments.

    I’m sorry if I was not clear before—the best example I can point to is the “Most Recent Comments” listing on the CP home page.

  • #6 / Jul 09, 2009 12:47pm

    Sue Crocker

    26054 posts

    Tony, you could always modify the existing plugin to do what you want, or construct a sql query to get what you’re looking for. I’d be happy to move this to the HowTo forum for additional community support.

  • #7 / Jul 09, 2009 1:18pm

    Tony Gravett

    34 posts

    Thanks, Sue ... that would be great to move it to the HowTo forum. I have also posted the same question on the {exp:latest_comments} plug-in thread, since that is very close to what I need.

  • #8 / Jul 09, 2009 4:51pm

    Ingmar

    29245 posts

    Moving as per request.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases