Welcome Guest, Not a member yet? Register   Sign In
Helper Count
#1

[eluser]perdel[/eluser]
Hi! I was using Pyro Cms recently, and now i am moving my project to codeigniter, but i have a problem: in pyro cms, in the views, you can use the Helper:Count to count the number of items being output in a tag loop:

Code:
{{ blog:posts }}
        {{ helper:count mode="subtract" start="10" }} -- {{ title }}
{{ /blog:posts }}
here this in the documentation
This is very useful, but i dont see in codeigniter anything like this.


Thanks!

#2

[eluser]pbflash[/eluser]
That's a plugin that is specific to PyroCMS and the template parser that they use.
#3

[eluser]perdel[/eluser]
[quote author="pbflash" date="1337814117"]That's a plugin that is specific to PyroCMS and the template parser that they use.[/quote]

And there is something like this in codeigniter? or someone has a library to do this?

Thanks for the answers Big Grin
#4

[eluser]Aken[/eluser]
Basic PHP. Easy peasy.

Code:
$i = 10;

foreach ($array as $item)
{
    // Do other stuff...
    echo $i; // 10
    $i--; // $i now equals 9
    // OR
    $i++; // $i now equals 11
}
#5

[eluser]perdel[/eluser]
[quote author="Aken" date="1337816768"]Basic PHP. Easy peasy.

Code:
$i = 10;

foreach ($array as $item)
{
    // Do other stuff...
    echo $i; // 10
    $i--; // $i now equals 9
    // OR
    $i++; // $i now equals 11
}
[/quote]

thank you very much!! I thought to do this i need for ($i = 10)...
Big Grin
#6

[eluser]Aken[/eluser]
for() creates a loop. If you're already looping through something using foreach(), you can just increase the count of a variable to see what iteration you're on.




Theme © iAndrew 2016 - Forum software by © MyBB