Creating a simple menu link in a module

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Locked
ButterBrot
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Wed Jul 29, 2009 4:51 pm

Creating a simple menu link in a module

Post by ButterBrot » Wed Jul 29, 2009 5:10 pm

Hi everybody!

I'm at the brink of despair :(

My idea was to create a little module, which shows just the nodes under the selected menu. Just showing all submenu items. For example we've:

Code: Select all

Company
- History
   - 2000
   - 2001
   - 2002
- News
If the user selects Company, the module shows History & News. If he selects History, the module shows 2000, 2001, 2002. Everything normally linked like in the menu.

I've coded that:

Code: Select all

defined('_JEXEC') or die('Restricted access');

require_once( JPATH_BASE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php' );

$active = &JSite::getMenu()->getActive();
$rows = &JSite::getMenu()->getItems('menutype', $active->menutype);

foreach ($rows as $rowItem) {
	if ($rowItem->parent == $active->id ){
	    echo '<a href="' . ContentHelperRoute::getArticleRoute($rowItem->id) .'">' . $rowItem->name  . '</a><br/>';
	}
}
I get the correct names. But Joomla creates always a not working link:
http://localhost/index.php?option=com_c ... 24&lang=de
(24 is the id of the parent)
instead of
http://localhost/index.php?option=com_c ... 34&lang=de

How do I create a link like in a normal menu??? I was searching for nearly 4 hours...nothing :(

Thanks for helping :)

ButterBrot
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Wed Jul 29, 2009 4:51 pm

Re: Creating a simple menu link in a module

Post by ButterBrot » Thu Jul 30, 2009 6:40 pm

Nobody any idea? :(

Ich found this threads:
http://forum.joomla.org/viewtopic.php?f=428&t=278877
http://forum.joomla.org/viewtopic.php?f=476&t=269637

But in each case nobody had an answer - am I doing such a stupid thing or didn't have anyone a plan to handle this? ;)

€dit:
Maybe I didn't post all facts - so:
I have a menu item which relating to an article. The only thing I want is to create an identic link like in the menu. ianmac wrote something about that here:
http://forum.joomla.org/viewtopic.php?f ... &p=1244640
But...I'm too stupid to found the solution. Strange thing...


Locked

Return to “Joomla! 1.5 Coding”