Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Increase Var in {section}

 
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
Chraensch
Smarty Rookie


Joined: 10 Sep 2003
Posts: 6

PostPosted: Wed Sep 10, 2003 11:04 am    Post subject: Increase Var in {section} Reply with quote

Hey all.

Maybe I'm just an Idiot, but I can't find a solution to this problem:

I'm trying, in a {section} loop, to increase a var but I keep failing, can anyone help me? here's the thingy:

Code:
{assign var="rep_var" value=0}
               {section name=subl loop=$headers}
                  {if $headers[subl]->parent == $headers[lp]->messageid}

                     {assign var="rep_var" value=+1} {* this is were I want to increase, I tried different methods but kept failing *}
                  {/if}
               {/section}
            {$rep_var}
Back to top
View user's profile Send private message
andre
Smarty Pro


Joined: 23 Apr 2003
Posts: 164
Location: Karlsruhe, Germany

PostPosted: Wed Sep 10, 2003 11:09 am    Post subject: Reply with quote

In current CVS version you can use

{assign var="rep_var" value=$rep_var+1}

Otherwise you need to use the math function

{math assign="rep_var" equation="x+1" x=$rep_var}
Back to top
View user's profile Send private message
Chraensch
Smarty Rookie


Joined: 10 Sep 2003
Posts: 6

PostPosted: Wed Sep 10, 2003 11:26 am    Post subject: Reply with quote

thank you, It works now. Used the math function as I'm not using the current CVS Version.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Sep 10, 2003 1:08 pm    Post subject: Reply with quote

just for the records: in your example you could also use {counter} or {$smarty.section.subl.index}
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hannamarin
Smarty n00b


Joined: 25 Jul 2016
Posts: 1

PostPosted: Mon Jul 25, 2016 9:27 am    Post subject: Reply with quote

you website title corresponds to all your articles! thanks for information! check http://bigessaywriter.com/blog/winning-emails-how-to-increase-replies for getting to know how to increase replies on your e-mail!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks 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