0

I would like to load my menues manually in the component layouts. Because of some programmend item detail views, there are no menu items for that views. The consequence is, that the menu is not shown in the items details views and layouts. Therefore I would like to integrate the menu manually inside the layout.

The classic method of loading a Joomla module in a component does not work:

$position = 'positionName';
$modules =& JModuleHelper::getModules($position); 
foreach ($modules as $module) { 
  echo JModuleHelper::renderModule($module); 
} 

In the module settings for the menu, you have to select the specific views, where the module has to be shown. For the programmend item detail views (like the detail view of an item in the administrators backend), there is no specific menu point. If there is no menu point, then you cannot activiate the menu module to be shown in the layout.

Furthermore, if the menu module is not activated for a specific view, than the menu module wont be loaded with the command:

$position = 'positionName';
$modules =& JModuleHelper::getModules($position); 

So how can I load the menu module manually for e.g. by module name?

2

JModuleHelper::getModules is a handy helper created to load modules in a convenient way. However, it follows certain business rules for CMS consistency. For example, to render modules assigned and published in a specific menu item.

If you are following different rules, you can implement your own JModuleHelper to load any module and render it.

  • You are right, now I made my own helper based on Joomlas standard JModuleHelper. – Perino Mar 7 '16 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.