0
When I make a menu-item that links to another menu (menu-alias, but also when I make an external link f.e.) I get a dropdown but I just want it to be a "normal" menu item. What goes wrong here?

<ul class="nav menu">
<li class="item-294 open">
<a href="/koning/" data-toggle="dropdown" aria-expanded="true">
Home
<i class="fa fa-caret-down"></i>
</a>
</li>

<li class="item-162 current active">
<a href="/koning/warme-zuidelijke-tuinen.html">Warme Zuidelijke tuinen</a>
</li>

So it should render as:

<ul class="nav menu">
<li class="item-294 open">
<a href="/koning/">Home</a></li>
<li class="item-162 current active">
<a href="/koning/warme-zuidelijke-tuinen.html">Warme Zuidelijke tuinen</a>
</li>

Im using latest blank bootstrap 3.8.0 / Joomla 3.4.1

I bought your e-book but can't find solution there, or missed it.

Accepted Answer

Mathieu
Mathieu
Offline
Friday, 29. May 2015, 11:06 - #permalink
0
Hi,

for alias links, you can modify frontend/html/mod_menu/default.php :
add case 'alias' : like this :

--------------------------------------------------------------------------------
// Render the menu item.
switch ($item->type) :
case 'separator':
case 'url':
case 'component':
case 'heading':
case 'alias' :
require JModuleHelper::getLayoutPath('mod_menu', 'default_' . $item->type);
break;
default:
require JModuleHelper::getLayoutPath('mod_menu', 'default_url');
break;
endswitch;
--------------------------------------------------------------------------------

and create default_alias.php in frontend/html/mod_menu :

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

defined('_JEXEC') or die;

// Note. It is important to remove spaces between elements.
$class = $item->anchor_css ? 'class="' . $item->anchor_css . '" ' : '';
$title = $item->anchor_title ? 'title="' . $item->anchor_title . '" ' : '';

if ($item->menu_image)
{
$item->params->get('menu_text', 1) ?
$linktype = '<img src="' . $item->menu_image . '" alt="' . $item->title . '" /><span class="image-title">' . $item->title . '</span> ' :
$linktype = '<img src="' . $item->menu_image . '" alt="' . $item->title . '" />';
}
else
{
$linktype = $item->title;
}

$flink = $item->flink;
$flink = JFilterOutput::ampReplace(htmlspecialchars($flink));

switch ($item->browserNav) :
default:
case 0:
?><a <?php echo $class; ?>href="<?php echo $flink; ?>" <?php echo $title; ?>><?php echo $linktype; ?></a><?php
break;
case 1:
// _blank
?><a <?php echo $class; ?>href="<?php echo $flink; ?>" target="_blank" <?php echo $title; ?>><?php echo $linktype; ?></a><?php
break;
case 2:
// window.open
$options = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,'.$params->get('window_open');
?><a <?php echo $class; ?>href="<?php echo $flink; ?>" onclick="window.open(this.href,'targetWindow','<?php echo $options;?>');return false;" <?php echo $title; ?>><?php echo $linktype; ?></a><?php
break;
endswitch;
--------------------------------------------------------------------------------
The reply is currently minimized Show
Responses (1)
  • Accepted Answer

    Tuesday, 07. July 2015, 13:28 - #permalink
    0
    I wish I could understand and write such code myself.

    Thanks a lot, this is working. :)
    The reply is currently minimized Show
Your Reply