3

For instance, if I have a position called 'position-1' and I've multiple modules in position-1. How can I get all module names based on position (in this case 'position-1')? Is it even possible? If so, how?

2 Answers 2

5

If you mean programatically, JModuleHelper should return the info you need.

$modules = JModuleHelper::getModules('position-1'); print_r($modules); 
4
  • What I get is - img.exs.lv/e/z/ezeliitis/Untitled_4.png Shouldn't I fetch two objects instead of only one? Commented Mar 27, 2017 at 11:46
  • It should return an array of all the modules in that position. I've tested it both on a template and a module. Curious that the object it returns for you has an ID of 0 when they usually start at 1? Are you creating/assigning modules via the module manager? Commented Mar 27, 2017 at 11:55
  • No, I do it like this: <jdoc:include type="modules" name="position-3" style="xhtml" /> Commented Mar 27, 2017 at 12:08
  • How are you assigning modules to that position, though? You seem to have a module position and a module which are both called position-3 - there may just be conflicts in your naming. Commented Mar 27, 2017 at 12:20
1

If you wish to know which modules are assigned to a specific template position, simple go to Extensions->Modules, then click Search Tools and then specifie the disired position in the Select Position select box. Hope that's what you are looking for.

1
  • Not exactly. I want to do it through program code (Using PHP). I have custom template (maybe this makes things clear). I thought Joomla have some way to get module parameters (in this case name/title) of specific position. Commented Mar 27, 2017 at 11:28

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.