Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Add results to X in a section

 
Post new topic   Reply to topic    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
cameleon
Smarty n00b


Joined: 31 May 2011
Posts: 4

PostPosted: Tue Jun 07, 2011 12:17 am    Post subject: Add results to X in a section Reply with quote

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
View user's profile Send private message
cameleon
Smarty n00b


Joined: 31 May 2011
Posts: 4

PostPosted: Tue Jun 07, 2011 8:59 pm    Post subject: Reply with quote

anyone ?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7285
Location: Lincoln Nebraska, USA

PostPosted: Wed Jun 08, 2011 1:57 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 4671
Location: Hamburg / Germany

PostPosted: Wed Jun 08, 2011 3:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Plugins 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