Pleaser help to create menu with nested urls.
I have a mulidimentual array, like this:
["Увлажнение"]=>
array(0) {
}
["Туалетная вода"]=>
array(0) {
}
["Духи и парфюмерная вода"]=>
array(0) {
}
["Мужские аксессуары"]=>
array(13) {
["Часы"]=>
array(1) {
["Часы"]=>
array(0) {
}
}
["Сумки и чехлы"]=>
array(8) {
["Спортивные сумки"]=>
array(0) {
}
["Сумки"]=>
array(0) {
}
["Рюкзаки"]=>
array(0) {
}
I have a function that create HTML Menu from this array:
function makeList($array) {
//Base case: an empty array produces no list
if (empty($array)) return '';
//Recursive Step: make a list with child lists
$output = '<ul>';
foreach ($array as $key => $subArray) {
$url = URLify::filter ($key);
$output .= '<li><a href="'.$url.'">' . $key .'</a>'. makeList($subArray) . '</li>';
}
$output .= '</ul>';
return $output;
};
That generame manu like:
Every menu urls like:
But i need urls like: muzhskie-aksessuary/chasy
With nested (with delemiter) urls.
Please help me. Thanks.
答案 0 :(得分:0)
您可以为此函数使用第二个参数:
set surround