I want to use the new router classes to implement SEF stuff. I still struggle to get it to work.

I have a view which can show categories. So this view is called categories. If you click a category, you see the categories view again. Despite the name of the view and that there is just one view, this is similar to what com_content is doing with the category view.

Here is my code for the router constructor:

$categories = new JComponentRouterViewconfiguration('categories');

That gives me an endless loop if I try to build routes for the categories view.

The class Joomla\CMS\Component\Router\RouterView\StandardRules seems to cause the issue here. Since my view has no parent, it can't have children. So the for (i = 0; i < .....) in line 237 the i variable is counted and down endlessly.

    $found2 = false;

if (count($views[$view]->children))
    $found = true;

I'm pretty sure the standard Joomla code supports a single nested view. But how? I'm very thankful for a little hint.

  • I'm looking at this and struggling as well! I did come across this post which may help. You might try copying the getCategorySegment and getCategoryId methods from the com_content code. I think with the old router it was a lot easier to debug your code. Mar 30, 2018 at 21:46
  • I created a copy of the original router and modified it so it works for me now. The ID-less routing is fine. But it does not feel right :( Mar 31, 2018 at 5:35
  • This might be a bug you know...
    – ed22
    Feb 5, 2020 at 11:06


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.