mirror of
https://github.com/nadrad/h-m-m.git
synced 2024-05-17 22:46:32 +02:00
padding the numbers
This commit is contained in:
parent
d06a279450
commit
9ce26f65ba
4
h-m-m
4
h-m-m
|
@ -983,6 +983,8 @@ function toggle_numbers(&$mm)
|
|||
if ($mm['active_node'] <= $mm['root'])
|
||||
return;
|
||||
|
||||
$padlen = count($mm['nodes'][ $mm['nodes'][$mm['active_node']]['parent'] ]['children']) > 9 ? 2 : 1;
|
||||
|
||||
$ordered= false;
|
||||
$i=1;
|
||||
foreach ($mm['nodes'][ $mm['nodes'][$mm['active_node']]['parent'] ]['children'] as $cid)
|
||||
|
@ -993,7 +995,7 @@ function toggle_numbers(&$mm)
|
|||
if ($ordered)
|
||||
$mm['nodes'][$cid]['title'] = mb_ereg_replace('^\d+\. *','',$mm['nodes'][$cid]['title']);
|
||||
else
|
||||
$mm['nodes'][$cid]['title'] = ($i++).'. '.$mm['nodes'][$cid]['title'];
|
||||
$mm['nodes'][$cid]['title'] = str_pad($i++, $padlen, '0', STR_PAD_LEFT).'. '.$mm['nodes'][$cid]['title'];
|
||||
|
||||
$mm['modified'] = true;
|
||||
build_map($mm);
|
||||
|
|
Loading…
Reference in a new issue