Changeset 1926 for branches/release-35/php/lib/block.mtfor.php
- Timestamp:
- 04/16/08 10:50:21 (20 months ago)
- Files:
-
- 1 modified
-
branches/release-35/php/lib/block.mtfor.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/release-35/php/lib/block.mtfor.php
r1174 r1926 7 7 8 8 function smarty_block_mtfor($args, $content, &$ctx, &$repeat) { 9 $localvars = array('__for_end', '__for_var' );9 $localvars = array('__for_end', '__for_var', '__out'); 10 10 11 11 if (!isset($content)) { … … 30 30 $ctx->stash('__for_end', $end); 31 31 $ctx->stash('__for_var', $var); 32 $ctx->stash('__out', false); 32 33 } else { 33 34 $index = $ctx->__stash['vars']['__index__'] + 1; … … 35 36 $end = $ctx->stash('__for_end'); 36 37 $var = $ctx->stash('__for_var'); 38 $out = $ctx->stash('__out'); 37 39 } 38 40 … … 46 48 if ($var) 47 49 $ctx->__stash['vars'][$var] = $index; 48 if (array_key_exists('glue', $args)) { 49 if ($index < $end) 50 $content = $content . $args['glue']; 50 if (isset($args['glue']) && !empty($content)) { 51 if ($out) 52 $content = $args['glue'] . $content; 53 else 54 $ctx->stash('__out', true); 51 55 } 52 56 $repeat = true; 53 57 } else { 58 if (isset($args['glue']) && $out && !empty($content)) 59 $content = $args['glue'] . $content; 54 60 $ctx->restore($localvars); 55 61 $repeat = false;
