Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty counter in (splitted) array

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Serpent Driver
Smarty n00b


Joined: 19 Oct 2016
Posts: 1

PostPosted: Wed Oct 19, 2016 9:46 am    Post subject: Smarty counter in (splitted) array Reply with quote

Hi all,

is there a smarty function like {counter} in foreach that continues counting if the array is splitted in more than 1 page?

{foreach name=aussen item=module_data from=$module_content}
{counter}

Output:
1
2
3
...
15
{/foreach}

next page

{foreach name=aussen item=module_data from=$module_content}
{counter}

Output:
1
2
3
...
15
{/foreach}

I've got a tipp to work with count and plus for every foreach loop instead of counter, but I don't know how. Can anyone help?
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Oct 19, 2016 10:52 am    Post subject: Reply with quote

How it is a Smarty question?
Each page is a separate PHP invocation, they can't possibly know what happened on the previous run, and if that previous run was ever performed.
YOU must make that information available for consecutive invocations. There's no magic involved.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP