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} functioning incorrectly

February 09, 2011 12:25pm

Subscribe [3]
  • #1 / Feb 09, 2011 12:25pm

    Color-ize

    27 posts

    My EE is:
    v2.1.1 - © Copyright Notice 2003 - 2010 EllisLab, Inc.
    Script executed in 1.3320 seconds - 27 SQL queries used - Build:  20101020

    According to this user guide:
    http://ellislab.com/expressionengine/user-guide/modules/channel/variables.html#var_count
    The count module should start with 0 as the first number. My {count} starts with the number 1. I need it to start at zero. Is there anyway for me to change it so it will start at zero - or can I set some sort of variable that will subtract from it {count}-1 (you get the idea)?

    Any help would be appreciated.
    Thanks!
    Seth

  • #2 / Feb 10, 2011 12:15am

    Brandon Jones

    5500 posts

    Hi Seth,

    You’re about a year behind on your installation; can you upgrade to 2.1.3 and see if that resolves the issue?

  • #3 / Feb 10, 2011 4:59pm

    Brandon Jones

    5500 posts

    Hi Seth,

    Count starts at 1, not zero. As the docs say,

    ...for the fourth entry the {count} variable would have a value of “4”.

    Since EE is working as expected, I can move this over to the CodeShare Corner if you still need help with a alternative. Let me know!

  • #4 / Feb 10, 2011 5:08pm

    narration

    773 posts

    Seth, you could have a look at MX Calculator, by Max Lazar. It receives mention often for things like this.

    EE is not a programming language, and it will give fits to someone used to those for a while. You also have embedded PHP available when needed, and can generally get it to work as intended with EE’s parsing order.

    Still, a plugin which will do math and return a value usable at the stage EE evaluates tag variables is probably a very good answer for things as you want. Am sure the oommunity would be interested to hear how you get along with this, so please post your results.

    Regards,
    Clive

  • #5 / Feb 10, 2011 5:15pm

    Ingmar

    29245 posts

    Moving as suggested by Brandon. Thanks.

  • #6 / Feb 26, 2011 6:39pm

    Color-ize

    27 posts

    Brandon - I totally read that sentence wrong - which of course could be due to the fact that I wanted it to work like the programming language…whoops. Thank you for letting me in on that secret (double checking my eyesight today - maybe I am having a case of “Walleye” vision (for those who have seen Hot Shots - if not just let it go)).

    narration - thank you for the suggestion I will look into it. I didn’t realize you could actually embed PHP code in EE so I may just resort to doing that. I’m working on it within a template so I assume that the end user won’t actually be posting anything in there. (If they do I will be super upset they are messing with things I don’t want them to - and they can just deal with what they screw up until they decide to front the bill of getting it fixed).

    Thanks for all the assistance. I am working on this issue today and tomorrow - so let’s buckle down and get on this.
    Seth

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

ExpressionEngine News!

#eecms, #events, #releases