/* More info: https://www.couchcms.com/forum/viewtopic.php?f=8&t=11368&p=30031#p30031 Sample usage: (1) (2) Note: do not pass numbers directly into 'data' param, use a variable instead - as in examples above. */ // Receive passed values by redefining them in local scope. // This makes sure passed params are not confused with global vars of same name - cms:get operates locally by default, cms:set sets locally // 'fdata' will have content of variable whose name is stored in argument 'data'. REQUIRED. If not present, nothing happens - error is not displayed by default. // 'fresult' will have content of passed argument 'result'. If not present, result will be printed. // 'fcount' will have content of passed argument 'count'. If not present, count will not be returned. // 'fsum' temporary variable to keep sum // 'ferrors' temporary array to keep errors Errors can be displayed by ERROR:
Total errors:
"> // Perform calculations: // Use 'parent' scope to get out of cms:each's scope and set sum to outside variable 'fsum' // Return results // Sum: put in variable or print // function doesn't know where to put results, but target variable's name is stored in 'fresult' // do not skip printing '0'