0

I am working for mega menu solution width standart joomla menu module 3.x. here is my code

    <?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_menu
 *
 * @copyright   Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

$id = '';

if (($tagId = $params->get('tag_id', '')))
{
    $id = ' id="' . $tagId . '"';
}

// The menu class is deprecated. Use nav instead
?>

<ul class="nav navbar-nav navbar-left <?php echo $class_sfx; ?> <?php echo $id; ?>">
<?php foreach ($list as $i => &$item)
{
    $class = 'item-' . $item->id;

    if ($item->id == $default_id)
    {
        $class .= ' default';
    }


    if (($item->id == $active_id) || ($item->type == 'alias' && $item->params->get('aliasoptions') == $active_id))
    {
        $class .= ' current';
    }

    if (in_array($item->id, $path))
    {
        $class .= ' active';
    }
    elseif ($item->type == 'alias')
    {
        $aliasToId = $item->params->get('aliasoptions');

        if (count($path) > 0 && $aliasToId == $path[count($path) - 1])
        {
            $class .= ' active';
        }
        elseif (in_array($aliasToId, $path))
        {
            $class .= ' alias-parent-active';
        }
    }

    if ($item->type == 'separator')
    {
        $class .= ' divider';
    }

    if ($item->deeper)
    {
        $class .= ' deeper';
    }

    if ($item->parent)
    {
        $attributes = array();
            if ($item->anchor_css)
            {
                $attributes['class'] = $item->anchor_css;
                $dropid = $attributes['class'];
            }
        //$class .= ' drop';
    }

    echo '<li class="' . $class . '">';

    switch ($item->type) :
        case 'separator':
        case 'component':
        case 'heading':
        case 'url':
            require JModuleHelper::getLayoutPath('mod_menu', 'custom_' . $item->type);
            break;

        default:
            require JModuleHelper::getLayoutPath('mod_menu', 'custom_url');
            break;
    endswitch;

    // The next item is deeper.
    if ($item->deeper)
    {
        echo '<div class="megadropdown">';
        echo '<div class="container">';
        echo '<div class="inner-megadropdown '. $dropid .'-dropdown">';
        echo '<div class="owl-wrapper">';
        echo '<ul class="horizontal-filter-posts">';
    }

    if ($item->anchor_title)
    {
        $attributes['title'] = $item->anchor_title;
        $modname = 'mod_k2_content';
        $modtitle = $attributes['title'];
        $document = JFactory::getDocument();
        $renderer = $document->loadRenderer('module');
        $module = JModuleHelper::getModule($modname,$modtitle);
        echo $renderer->render($module);
    }

    // The next item is shallower.
    elseif ($item->shallower)
    {
        echo '</li>';
        echo str_repeat('</ul></div></div></div></div></li>', $item->level_diff);
    }
    // The next item is on the same level.
    else
    {
        echo '</li>';
    }
}
?>
</ul>

I am using link title atribute field to render module wich I want to show in deeper, it works good but I need render module above ul but inside div classes and I have no idea how.

0

I found solution for my question:

echo str_repeat('</ul>'.$renderer->render($module).'</div></div></div></div></li>', $item->level_diff);

I render module in str repeat after ul so my problem solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.