Show
Ignore:
Timestamp:
04/16/08 10:50:21 (20 months ago)
Author:
takayama
Message:

Fixed BugId:76389
* Loop tags does not add 'glue', if row in loop tag was empty

  • MTFor
  • MTLoop
  • MTTags
  • MTEntryTags
  • MTEntries
  • MTEntryCategories
  • MTCategories
  • MTEntryAdditionalCategories
  • MTParentCategories
  • MTAssetTags
  • MTPagerBlock
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-35/php/lib/block.mtfor.php

    r1174 r1926  
    77 
    88function smarty_block_mtfor($args, $content, &$ctx, &$repeat) { 
    9     $localvars = array('__for_end', '__for_var'); 
     9    $localvars = array('__for_end', '__for_var', '__out'); 
    1010 
    1111    if (!isset($content)) { 
     
    3030        $ctx->stash('__for_end', $end); 
    3131        $ctx->stash('__for_var', $var); 
     32        $ctx->stash('__out', false); 
    3233    } else { 
    3334        $index = $ctx->__stash['vars']['__index__'] + 1; 
     
    3536        $end = $ctx->stash('__for_end'); 
    3637        $var = $ctx->stash('__for_var'); 
     38        $out = $ctx->stash('__out'); 
    3739    } 
    3840 
     
    4648        if ($var) 
    4749            $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); 
    5155        } 
    5256        $repeat = true; 
    5357    } else { 
     58        if (isset($args['glue']) && $out && !empty($content)) 
     59            $content = $args['glue'] . $content; 
    5460        $ctx->restore($localvars); 
    5561        $repeat = false;