There is nothing quite like helpful as parsing strings with cms:each.
However, for many years CouchCMS had it wrong, outputting k_count starting with '0', which is counter intuitive for end-users. How 'count' can be zero in a non-empty string?
Also, it was always a overly-complicated task to get total number of elements in a separated string, since coders must introduce a new variable etc.., not to mention that total count of elements was not available before the cms:each ends its routine.
Respecting the default behavior( actually, respecting your existing codes with cms:each ) I made a simple tweak that allows to use system variable k_total_count or k_count_total ( 100% identical to make it easy to remember without looking into docs ) inside the cms:each loop on every pass.
If you, just like me, have common sense and like counting to start from '1' then use new parameter startcount and make it startcount='1'( similar to the same existing parameter in cms:repeat ). This way the last k_count and k_total_count will 100% match.
However, for many years CouchCMS had it wrong, outputting k_count starting with '0', which is counter intuitive for end-users. How 'count' can be zero in a non-empty string?
Also, it was always a overly-complicated task to get total number of elements in a separated string, since coders must introduce a new variable etc.., not to mention that total count of elements was not available before the cms:each ends its routine.
Respecting the default behavior( actually, respecting your existing codes with cms:each ) I made a simple tweak that allows to use system variable k_total_count or k_count_total ( 100% identical to make it easy to remember without looking into docs ) inside the cms:each loop on every pass.
If you, just like me, have common sense and like counting to start from '1' then use new parameter startcount and make it startcount='1'( similar to the same existing parameter in cms:repeat ). This way the last k_count and k_total_count will 100% match.