Advertisement
Guest User

Mannequin

a guest
Nov 18th, 2008
682
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. c.. function rvm_counter($atts)
  2. {
  3.     extract(lAtts(array(
  4.     'name'   => '',
  5.     'offset' => '0',
  6.     'reset'  => '',
  7.     'step'   => '1',
  8.     'width'  => '1'
  9.     ), $atts));
  10.  
  11.     static $counter = array();
  12.  
  13.     $name = 'rvm_counter_'.$name;
  14.  
  15.     if (!isset($counter[$name]))
  16.         {
  17.         $counter[$name] = ($reset !== '') ? intval($reset) : intval($step);
  18.         }
  19.     else
  20.         {
  21.         $counter[$name] = ($reset !== '') ? intval($reset) : $counter[$name] + intval($step);
  22.         }
  23.  
  24.     return sprintf('%0'.intval($width).'d', $counter[$name] + intval($offset));
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement