I have an issue in Joomla where I have a module that creates a select dropdown list from a menu.
Works great if I have just 1 dropdown on a page – if I have 2 dropdowns by creating another instance of the module pulling from another menu (i.e. dropdown1 & dropdown2) the page crashes.
I was wondering if it is to do with the following code in my modules default.php tmpl file:
<?php
// No direct access.
defined('_JEXEC') or die;
?>
<form name="SelMenFrm">
<?php if($params->get('showLabel') == 1) echo $params->get('selectLabel')." "; ?>
<select name="SelMenSel" class="<?php echo $class_sfx;?>" onchange="javascript:location.href=document.SelMenFrm.SelMenSel.options[document.SelMenFrm.SelMenSel.selectedIndex].value;">
<option><?php echo $params->get('topText');?></option>
<?php
foreach ($list as $i => &$item) :
// Determine if item shoud be set as selected
$selected = "";
if (($item->home == 0) && ($item->id == $active_id)) $selected = "selected=\"selected\"";
// Set indent
if ($item->level == 1) $indent = "";
if ($item->level == 2) $indent = " - ";
if ($item->level == 3) $indent = " - - ";
if ($item->level == 4) $indent = " - - - ";
if ($item->level == 5) $indent = " - - - - ";
if ($item->level == 6) $indent = " - - - - - ";
echo "<option ".$selected."value=\"".$item->flink."\">".$indent.$item->title."</option>";
endforeach;
?>
</select></form>
Any ideas/help would be really appreciated 😉
Thanks
what about that?