Thread:Project:Support desk/How to customize auto-numbering of TOCs/reply (4)

Thanks for pointing me to the function's location. I just rewrote the function for my wiki:

// http://www.go4expert.com/forums/showthread.php?t=4948 private static function numberToRoman($num) { $n = intval($num); $result = '';

$romans = array(			'M' => 1000, 			'CM' => 900, 			'D' => 500, 			'CD' => 400,			'C' => 100, 			'XC' => 90, 			'L' => 50, 			'XL' => 40,			'X' => 10, 			'IX' => 9, 			'V' => 5, 			'IV' => 4, 			'I' => 1		); foreach ($romans as $roman => $latin) { $matches = intval($n / $latin); $result .= str_repeat($roman, $matches); $n = $n % $latin; }		return $result; }	static function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex = false ) { $classes = "toclevel-$level"; if ( $sectionIndex !== false ) { $classes .= " tocsection-$sectionIndex"; }		$numbers = explode('.', $tocnumber); $tocnumbers = ""; for ($i = 0; $i < count($numbers); $i++) { switch ($i) { case 0: # upper-roman $tocnumbers .= self::numberToRoman($numbers[$i]); break; case 1: # upper-latin $tocnumbers .= chr(64 + $numbers[$i]); break; case 2: # decimal $tocnumbers .= $numbers[$i]; break; case 3: # lower-latin $tocnumbers .= strtolower(chr(64 + $numbers[$i])); break; case 4: # lower-roman $tocnumbers .= strtolower(self::numberToRoman($numbers[$i])); break; case 5: # lower-greek $tocnumbers .= "&#". ($numbers[$i] + 944). ";";					break; default: $tocnumbers .= $numbers[$i]; }			$tocnumbers .= ". "; }		return "\n '. $tocnumbers. ' ' .			$tocline. ' '; }