Hi,
I am totally useless with php, so would appreciate any advice.
I need to moderate - make an alternate - joomla module menu php file which adds a tag to the output. I have added the but it is not in the right position. I can only get it either before or after the anchor tag, not in between as needed.
The output for the menu and one menu item is:
[code]
[/code]I need the tag inside the anchor tag in order for my background hover and link function to work correctly, like this:
[code]
- Udvikling [/code]
- @package Joomla.Site
- @subpackage mod_menu
- @copyright Copyright © 2005 - 2012 Open Source Matters, Inc. All rights reserved.
-
@license GNU General Public License version 2 or later; see LICENSE.txt
*/
Can anyone help me??
This is the current php code (which gives the wrong placement):
[php]<?php
/**
defined(’_JEXEC’) or die;
// Note. It is important to remove spaces between elements.
?>
- get('tag_id') != null)
{
$tag = $params->get('tag_id').'';
echo ' id="'.$tag.'"';
}
?>>
<?php
foreach ($list as $i => &$item) :
$class = 'item-'.$item->id;
if ($item->id == $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) {
$class .= ' parent';
}
if (!empty($class)) {
$class = ' class="'.trim($class) .'"';
}
echo '<li'.$class.'><span></span>';
// Render the menu item.
switch ($item->type) :
case 'separator':
case 'url':
case 'component':
case 'heading':
require JModuleHelper::getLayoutPath('mod_menu', 'default_'.$item->type);
break;
default:
require JModuleHelper::getLayoutPath('mod_menu', 'default_url');
break;
endswitch;
// The next item is deeper.
if ($item->deeper) {
echo '<ul class="nav-child unstyled small">';
}
// The next item is shallower.
elseif ($item->shallower) {
echo '</li>';
echo str_repeat('</ul></li>', $item->level_diff);
}
// The next item is on the same level.
else {
echo '</li>';
}
endforeach;
?>[/php]
Thanks in advance!!!
/Soren