Get menu from menuid - Joomla! Forum - community, help and support


i trying menu using menu id. menu not active menu.

i doing

$application = jfactory::getapplication();
$menu = $application->getmenu();
$item = $menu->getitem( '345');

it gives me error saying
fatal error: call member function getitem() on non-object in /home/imh/public_html/administrator/component.......

any hints appreciated.

thanks

nirmalthapa wrote:i trying menu using menu id. menu not active menu.

i doing

$application = jfactory::getapplication();
$menu = $application->getmenu();
$item = $menu->getitem( '345');

it gives me error saying
fatal error: call member function getitem() on non-object in /home/imh/public_html/administrator/component.......

any hints appreciated.

thanks


hi nirmalthapa,

it looks getitem() not instance of object. if defined value '345' does?

such as:

code: select all

$application = jfactory::getapplication();
$menu = $application->getmenu();
$itemid = jrequest::getint('id', '345');
$item = $menu->getitem($itemid);


now when var_dump($item), results , information related menu id of 345, means $item pulling correct information. i'm not php expert, love troubleshooting it. :-)

let me know if helps.





Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

PProHeadless.exe has stopped working error when opening projects in Adobe Media Encoder CS6

Preconditions Failed. - Joomla! Forum - community, help and support