|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
cameleon Smarty n00b
Joined: 31 May 2011 Posts: 4
|
Posted: Tue Jun 07, 2011 12:17 am Post subject: Add results to X in a section |
|
|
Code: |
{section name=CLINICSSCORE loop=$CLINICS_SCORECOUNT start=0}
{if ($CLINICS_ID[CLINICS] == $CLINICS_INPUTID[CLINICSSCORE])}
{$CLINICS_SCORE[CLINICSSCORE]}
{/if}
{/section}
|
I would want to add each result that show in if statement to each other, so after loop finish i got results
in php it simply would look like this
$XXX += $CLINICS_SCORE[$X];
[/code] |
|
Back to top |
|
cameleon Smarty n00b
Joined: 31 May 2011 Posts: 4
|
Posted: Tue Jun 07, 2011 8:59 pm Post subject: |
|
|
anyone ? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Jun 08, 2011 1:57 am Post subject: |
|
|
try echoing all the variable values in the loop to debug it, make sure you are comparing what you think you are. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Jun 08, 2011 3:31 pm Post subject: |
|
|
Maybe something like this:
Code: | {$xxx = 0}
{section name=CLINICSSCORE loop=$CLINICS_SCORECOUNT start=0}
{if ($CLINICS_ID[CLINICS] == $CLINICS_INPUTID[CLINICSSCORE])}
{$CLINICS_SCORE[CLINICSSCORE]}
{$xxx = $xxx + $CLINICS_SCORE[CLINICSSCORE]}
{/if}
{/section}
result {$xxx} |
|
|
Back to top |
|
|
|
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
|