Dotclear

Changeset 2774:65395d6bf0a5


Ignore:
Timestamp:
11/10/14 15:46:31 (11 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Extends loopPosition in order to specify a modulo. Fixes #1978

Location:
inc/public
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inc/public/class.dc.template.php

    r2666 r2774  
    432432          $length = isset($attr['length']) ? (integer) $attr['length'] : 'null'; 
    433433          $even = isset($attr['even']) ? (integer) (boolean) $attr['even'] : 'null'; 
     434          $modulo = isset($attr['modulo']) ? (integer) $attr['modulo'] : 'null'; 
    434435 
    435436          if ($start > 0) { 
     
    438439 
    439440          return 
    440           '<?php if ($_ctx->loopPosition('.$start.','.$length.','.$even.')) : ?>'. 
     441          '<?php if ($_ctx->loopPosition('.$start.','.$length.','.$even.','.$modulo.')) : ?>'. 
    441442          $content. 
    442443          "<?php endif; ?>"; 
  • inc/public/lib.tpl.context.php

    r2676 r2774  
    5959 
    6060     # Loop position tests 
    61      public function loopPosition($start,$length=null,$even=null) 
     61     public function loopPosition($start,$length=null,$even=null,$modulo=null) 
    6262     { 
    6363          if (!$this->cur_loop) { 
     
    9494          if ($even !== null) { 
    9595               $test = $test && $index%2 == $even; 
     96          } 
     97 
     98          if ($modulo !== null) { 
     99               $test = $test && ($index % $modulo == 0); 
    96100          } 
    97101 
Note: See TracChangeset for help on using the changeset viewer.

Sites map