更新时间:2023-12-05 18:20:16
本人已解决问题:
如果您的组件只有一个菜单项(否则您必须选择正确的菜单项),则只需将以下行添加到代码中即可:
In the case that you have only one menu item for your component (else you have to pick the right one) you just have to add these lines to your code:
$app = JFactory::getApplication();
$menu = $app->getMenu();
$items = $menu->getItems('component', 'com_games');
if (!isset($query['Itemid']))
$query['Itemid'] = $items->id;
现在,joomla将使用菜单项别名来生成sef url.
Now joomla takes the menu item alias for generating the sef urls.