I have a requirement to support two different types of views. Example views are like below.

|_ Items
|__ Item
|_ Another Items
|__Another Item

So I am registering the views in the router as below.

$type1 = new JComponentRouterViewconfiguration('type1');
$type1 ->setKey('id')->setParent($category, 'catid');
$this  ->registerView($item);

$type2 = new JComponentRouterViewconfiguration('type2');
$type2 ->setKey('id');
$this  ->registerView($type2);

The first item pages works fine and ID of the item is successfully recognised. But when I go to item2 page, the ID of the item cannot be recognized from the URL. Any suggestions?

  • I would suggest you have used $this->registerView($item); which would use the current item? Just a guess. As a second guess in the second example you do not register setParent. Again, just a guess. – Eoin Aug 17 '18 at 22:45
  • I have two different set of items, let's say Articles and User Profiles in the same component. So I am trying to design routing for them. Articles can have category as parent, user profiles do not have any parent. And already using $this->registerView – Nagarjun Aug 18 '18 at 19:46

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.