Get Menu ID

This forum is for general questions about extensions for Joomla! 2.5.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
User avatar
dagger2002
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 162
Joined: Wed Mar 26, 2008 4:22 pm
Location: So. Cal

Get Menu ID

Post by dagger2002 » Wed Aug 03, 2011 7:03 pm

Hey Guys I have fixed one issue to find another.

When i click on my Latest News Module I lose my item ID. Which means when I have a module assigned to the home page menu item only, it disappears. So I am looking for a way to grab the menu Id So that I can reset it up, or make sure that is correct.

Thanks


PS

I am using 1.7.

User avatar
dagger2002
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 162
Joined: Wed Mar 26, 2008 4:22 pm
Location: So. Cal

Re: Get Menu ID

Post by dagger2002 » Fri Aug 05, 2011 5:58 pm

Any one have any idea how to get the menu item that is being used. I have spent many hours combing the api / documentation, and have come up with bupkiss. Cant find a solution to this issue.

I have figured out it is how the article is being linked between the news module, and a menu item. They are different.

Thanks

oikkis
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Sun Aug 07, 2011 6:24 am
Contact:

Re: Get Menu ID

Post by oikkis » Sun Aug 07, 2011 7:42 am

Here some menu things...

Code: Select all

// get application
$app	= JFactory::getApplication();

// get menu
$menu	= $app->getMenu();

// get active menu id
$activeId = $menu->getActive()->id;

// get active menu
$active	= $menu->getActive();

// get active menu id
$activeId = $active->id;

// get active parent id	
$currentMenuParent = $active->parent_id;
			
// get active menu item title
$menutitle = $active->title;
		
// get menu item by id
$otherMenuItem = $menu->getItem( $menuID );

// get other menu item title
$title = $otherMenuItem->title;
"Computer says no" - C. Beer

User avatar
dagger2002
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 162
Joined: Wed Mar 26, 2008 4:22 pm
Location: So. Cal

Re: Get Menu ID

Post by dagger2002 » Mon Aug 08, 2011 4:47 pm

Ok its giving me nothing.

This is telling me that joomla isnt passing a menu item to the page.


Any Ideas?

User avatar
dagger2002
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 162
Joined: Wed Mar 26, 2008 4:22 pm
Location: So. Cal

Re: Get Menu ID

Post by dagger2002 » Wed Aug 10, 2011 10:42 pm

Does any one have a suggestion on how I can get my menu id to be recognized?


I am using core components and its not working.

oikkis
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Sun Aug 07, 2011 6:24 am
Contact:

Re: Get Menu ID

Post by oikkis » Thu Aug 11, 2011 5:41 am

Maybe you have some corrupted files there. Try to upload new core files.
"Computer says no" - C. Beer

User avatar
dagger2002
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 162
Joined: Wed Mar 26, 2008 4:22 pm
Location: So. Cal

Re: Get Menu ID

Post by dagger2002 » Mon Aug 15, 2011 2:52 pm

This is getting weird.

Now I am getting the following message whenever I go to the site.

The URL is not valid and cannot be loaded.

Any thoughts?

Pocketss
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 105
Joined: Thu Aug 27, 2009 3:07 am
Location: Troy, MI - USA

Re: Get Menu ID

Post by Pocketss » Wed Aug 17, 2011 11:32 pm

dagger2002 wrote:Does any one have a suggestion on how I can get my menu id to be recognized?


I am using core components and its not working.
Where is it that you writing code?

Taking a stab here, when you click on the an item in the Lastest News module, that item is your "active" item, so you won't be able to get an Menu Id/Item Id, unless you have already created a menu link to that item in the backend. Since it doesn't have an item id, have you tried to set an item id? and see if it works.

Are you going to alter the latest news module to add Item ids' in theres?

I doubt your files are corrupt.

User avatar
dagger2002
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 162
Joined: Wed Mar 26, 2008 4:22 pm
Location: So. Cal

[SOLVED] Get Menu ID

Post by dagger2002 » Thu Aug 18, 2011 7:03 pm

I found a solution. The files had gone corrupt.

Reinstalled, luckyily it is still a dev site with very little stuff in it, Everything is working great.


Locked

Return to “Extensions for Joomla! 2.5”