我有一个包含简单付款方式的组件.我只想获取当前菜单项ID.我已经尝试了几件事来获取身份证.
//get the active menu item id
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$activeId = $active->id;
JLog::add('active id is: '.$activeId); //I get nothing returned
$currentMenuId = JSite::getMenu()->getActive()->id ;
JLog::add('menu id is: '.$currentMenuId); //I get nothing returned
//try to see what the current url is
$currenturl = JURI::current();
JLog::add('current url is: '.$currenturl); //I get mysite.com/index.php
Run Code Online (Sandbox Code Playgroud)
我$activeId
在我的插件中使用代码没有问题,但它在我的组件中不起作用.我错过了什么?
Lod*_*der 17
$app = JFactory::getApplication();
$menu = $app->getMenu()->getActive()->id;
echo $menu;
Run Code Online (Sandbox Code Playgroud)
希望这是你正在寻找的
归档时间: |
|
查看次数: |
21399 次 |
最近记录: |