Multiple controllers

57 views
Skip to first unread message

Mike

unread,
Sep 18, 2021, 10:43:42 AM9/18/21
to Joomla! General Development
Hiya!

So, I haven't yet figured out how J4 manages multiple controllers. The following guide is pretty dated by now

https://stackoverflow.com/questions/6606010/using-multiple-controllers-in-joomla-component-development

and poking around in the source code for the com_users-component (for example) hasn't helped me very much.

I'd basically like to know how J4 selects which controller to use, or how I could select which controller tthe component should use.

Thank you very much in advance.

Mike

Hannes Papenberg

unread,
Sep 18, 2021, 11:00:43 AM9/18/21
to Joomla! General Development
Use &task=[controller].[task] in the request.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/joomla-dev-general/8429f6c7-8387-401e-a8f9-a919c1e7f925n%40googlegroups.com.

Mike

unread,
Sep 18, 2021, 11:57:07 AM9/18/21
to Joomla! General Development
Hi!

Thx for the answer - clarifies it a bit. But there is no way of selecting it myself in the code, like in the previous versions? Also (newbie question...) how do I add the part  &task=[controller].[task] to a menu item? At the moment I only manage to get the request index.php?option=com_foo&view=bar.

cheers,

  mike

Hannes Papenberg

unread,
Sep 22, 2021, 4:28:15 AM9/22/21
to joomla-de...@googlegroups.com
You can of course select it yourself, but that is more work than the
given method. If you want to use different tasks than "view" in your
menu item (which seems wrong in most cases...) then you have to create
the XML file not in the views layout folder, but higher up. To help you,
we would need more context and most likely the specific code/extension
you are working on.
> <https://groups.google.com/d/msgid/joomla-dev-general/8429f6c7-8387-401e-a8f9-a919c1e7f925n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to joomla-dev-gene...@googlegroups.com
> <mailto:joomla-dev-gene...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/joomla-dev-general/c43d0728-9089-4ba8-a664-70d42248311an%40googlegroups.com
> <https://groups.google.com/d/msgid/joomla-dev-general/c43d0728-9089-4ba8-a664-70d42248311an%40googlegroups.com?utm_medium=email&utm_source=footer>.

Mike

unread,
Sep 23, 2021, 2:40:51 AM9/23/21
to Joomla! General Development
If you want to use different tasks than "view" in your
menu item (which seems wrong in most cases...)


Well, suppose I have many different views which serve many different purposes - all to be selected from a menu.

All in all - the "old" system (which I referred to in the original post) seems to allow you to pick the controller in the code. This is not possible anymore, then?

--mike

Mike

unread,
Sep 28, 2021, 1:22:48 AM9/28/21
to Joomla! General Development
You can of course select it yourself, but that is more work than the
given method


So, what I originally asked for is precisely how I would go about to select it myself. Any pointers, code examples or such?

--m
Reply all
Reply to author
Forward
0 new messages