I have the following problem/setup: I develop a custom component in Joomla that has multiple views. The views should have links to each other. If I enable SEF in the global configuration, the links in the menu are something like /index.php/<menu-alias> or /<menu-alias> depending on the rewriting rules.

Assume the views to be called a and b. The corresponding menu entries have aliases menuA and menuB (just for simpler communication here). If I open the menuA entry, a link to view b will look like /menuA?view=b. I would rather prefer to have a url like /menuB.

I need this changed url because the menu entries will not be in the very same menu and the visibility of the menu's module will depend on the current menu entry. And this will break depending of the url to be either /menuA?view=b or /viewB.

I found this documentation on joomla docs that clearly indicates the way the routing works and that a modification (call it optimization) of the url needs to be performed before SEF rules are applied. However there are no [Component]RouteHelper classes in the current joomla core as mentioned and I think the class Joomla\CMS\Helper\RouteHelper is not what I am looking for (at least I do not get a good documentation on its usage).

Another stack exchange question gave me the impression that manual searching in the database might be an option.

How can I find the correct url of the "other" view programatically in a clean way?

Your Answer

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

Browse other questions tagged or ask your own question.