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.

Best way to count entries in a channel

May 05, 2011 7:14am

Subscribe [2]
  • #1 / May 05, 2011 7:14am

    aelvan

    33 posts

    What is the easiest/least resource-demanding way of counting the number of entries in a channel? I need a way to just say “There are 32 entries in channel xxx (with status blablabla and category xxx)”...

    @ndre

  • #2 / May 05, 2011 8:20am

    Mark Bowen

    12637 posts

    Hiya,

    There is the Statistics Module which will allow you to retrieve these variables :

    {last_comment_date format="%m/%d/%Y %h:%i %a"}
    {last_entry_date format="%m/%d/%Y %h:%i %a"}
    {last_visitor_date format="%m/%d/%Y %h:%i %a"}
    {most_visitor_date format="%m/%d/%Y %h:%i %a"}
    {most_visitors}
    {total_anon}
    {total_comments}
    {total_entries}
    {total_guests}
    {total_logged_in}
    {total_members}

    Anything past that though and you would probably be looking at a query to get at what you need in the most efficient way.

    Hope that helps a bit.

    Best wishes,

    Mark

  • #3 / May 05, 2011 10:40am

    aelvan

    33 posts

    Ok, solved it with a custom query. Had to do selects with different statuses and different categories. Feels hacky though…. 😊

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

ExpressionEngine News!

#eecms, #events, #releases