Page 1 of 1

Disable subcategories from menu

Posted: Fri Feb 08, 2013 5:12 pm
by dudumagic
How can disable the subcategories from the menu in heder ?

Code: Select all

<?php if ($categories) { ?>

<div id="menu">

  <ul>

    <?php foreach ($categories as $category) { ?>

    <li><a href="<?php echo $category['href']; ?>"><span><?php echo $category['name']; ?></span></a>

      <?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 } ?>

  </ul>

</div>

<?php } ?>

Re: Disable subcategories from menu

Posted: Fri Feb 08, 2013 10:05 pm
by daik01
this would do the trick

Code: Select all

<?php if ($categories) { ?>

    <div id="menu">

      <ul>

        <?php foreach ($categories as $category) { ?>

        <li><a href="<?php echo $category['href']; ?>"><span><?php echo $category['name']; ?></span></a>

          <?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 } ?>

      </ul>

    </div>

    <?php } ?>