We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Count variable starting with zero

Feature Requests

Jason Boothman's avatar
Jason Boothman
3 posts
8 years ago
Jason Boothman's avatar Jason Boothman

Would we be able to get a separate count variable that starts at zero instead of one? Sometimes we are using jquery implementations that require a count starting with zero which means we need to install/leverage a math add-on, when it would be nice for me to just have a variable is zero based.

       
TJ Draper's avatar
TJ Draper
222 posts
8 years ago
TJ Draper's avatar TJ Draper

For whatever it’s worth, any of my add-ons that have loop tags output an {namespace:index}variable that is just that. Would definitely be good to see this go native.

       
deswork's avatar
deswork
93 posts
8 years ago
deswork's avatar deswork

I need to do this. I’m using bxSlider and channel entries to create a slider.

<a data-slide-index=”[count]” href=”“> starts the count at 1, for the bxSlider to work it needs to start at 0.

Is there a way to do this with ExpressionEngine 3.5.6?

Thanks

Wayne.

       
TJ Draper's avatar
TJ Draper
222 posts
8 years ago
TJ Draper's avatar TJ Draper

The way to get this done for now would probably be to use something like this: https://github.com/caddis/math

{exp:channel:entries [param]}
    <a
        data-slide-index="{exp:math formula='[1] - 1' params='{count}'}"
        href="">
{/exp:channel:entries}
👍 1
       
deswork's avatar
deswork
93 posts
8 years ago
deswork's avatar deswork

Thanks TJ.

This would definitely be good to see this native.

       
Hop Studios's avatar
Hop Studios
459 posts
8 years ago
Hop Studios's avatar Hop Studios

I would also like to see {index} or {count_index} as a fairly standard tag throughout EE.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.