Answer the question
In order to leave comments, you need to log in
How to combine 2 site menus?
Hello, there is a site hollywood-salon.com.ua, it has two menus, the first:
and the second:
I want to combine these two menus into one, that is, add a service item to the first menu, a list consisting of a second menu will drop out of this item I know how to do it, but the problem is that the first menu is written like this:
<?php if ($categories) { ?>
<?php
// ---------------- CUSTOM MENU ------------------
$newcats = array(
array(
'name' => 'Акции',
'href' => '/index.php?route=information/news',
'children' => array(),
'active' => false,
'column' => '1',
),
array(
'name' => 'Новинки',
'href' => '/news',
'children' => array(),
'active' => false,
'column' => '1',
),
array(
'name' => 'Прейскурант',
'href' => '/price',
'children' => array(),
'active' => false,
'column' => '1',
),
array(
'name' => 'Галерея',
'href' => '/galereya',
'children' => array(),
'active' => false,
'column' => '1',
),
array(
'name' => 'Интернет-магазин',
'href' => '#',
'children' => array(),
'active' => false,
'column' => '1',
),
array(
'name' => 'Подарочный сертификат',
'href' => '/sert',
'children' => array(),
'active' => false,
'column' => '1',
),
array(
'name' => 'Контакты',
'href' => '/index.php?route=information/contact',
'children' => array(),
'active' => false,
'column' => '1',
),
array(
'name' => 'Услуги',
'href' => 'index.php?route=information/information&information_id=52',
'children' => array(),
'active' => false,
'column' => '1',
),
);
$shop_cat = &$newcats[5];
$shop_cat['children'] = $categories;
$uri = $_SERVER['REQUEST_URI'];
//var_dump($uri);
$active_set = false;
foreach ($newcats as &$cat) {
if ($cat['href'] == $uri) {
$cat['active'] = true;
$active_set = true;
break;
}
}
if (!$active_set) {
$shop_cat['active'] = true;
}
?>
<div id="menu">
<ul>
<?php foreach ($newcats as $category) { ?>
<li><?php if ($category['active']) { ?>
<a href="<?php echo $category['href']; ?>" class="active"><?php echo $category['name']; ?></a>
<?php } else { ?>
<a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
<?php } ?>
<?php if ($category['children']) { ?>
<div>
<?php for ($i = 0; $i < count($category['children']);) { ?>
<ul>
<?php $j = $i + ceil(count($category['children']) / $category['column']); ?>
<?php for (; $i < $j; $i++) { ?>
<?php if (isset($category['children'][$i])) { ?>
<li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li>
<?php } ?>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
</li>
<?php } ?>
<?php /*
Answer the question
In order to leave comments, you need to log in
THE CODE IS HORRIBLE
If you don't know your site and PHP, then why the hell are you going to change something there?
If you are a coder, feel free to tell the customer to put the code in order or pay double the price (transfer half to me and I will help you xD).
And in other cases - pay.
It is unlikely that anyone will want to parse such code, even if it is small
Well, here is a piece from the array:
array(
'name' => 'Услуги',
<b> 'href' => 'index.php?route=information/information&information_id=52',</b>
'children' => array(),
'active' => false,
'column' => '1',
),
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question