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.

Count in list

November 17, 2011 10:57am

Subscribe [2]
  • #1 / Nov 17, 2011 10:57am

    DerLola

    12 posts

    Hi there,

    Is there an easy way to show the index of a channel entry?

    {exp:channel:entries channel="news" dynamic="no" limit="15"}
     {index} - {title}
    {/exp:channel:entries}

    I want index to be 1 to 15. Thanks in advance!

  • #2 / Nov 17, 2011 12:47pm

    Unless I am misunderstanding the question you should be able to just use {count}

  • #3 / Nov 17, 2011 4:09pm

    DerLola

    12 posts

    Thanks a lot for your reply. And yes that is stupidly simple. It doesn’t seem to work properly with pagination though, but at least it’s something.

    Thanks

  • #4 / Nov 17, 2011 4:21pm

    What is happening when you paginate? Shouldn’t be any problems there. If you are referring to it starting back at 1 instead of from the very beginning what you are looking for is {absolute_count} which takes all entries paginated or no into account.

  • #5 / Nov 17, 2011 4:47pm

    DerLola

    12 posts

    Yeah, that is the case. It starts back at one on every page. The {absolute_count} works for all my regular channel entries, but not for my users list and that’s exactly where I would like to use this. I realize this is sort of out of scope of this forum, since I’m using Solspace’s User module.

    We decided to just show the total number of users and I ended up with writing a tiny bit of custom code to get it. In case anyone finds this thread:

    {exp:query sql="SELECT count(member_id) AS total_users FROM exp_members"}
     {total_users}
    {/exp:query}

    So thanks for your help!

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

ExpressionEngine News!

#eecms, #events, #releases