I have created a view for my custom component and it works OK however I've noticed that JRoute
only works for the current view.
If I am, for example, on the view picture
and I try to "JRoute another view", instead of showing this view I just "JRouted to", it shows the same picture
view.
Example:
JRoute("index.php?option=com_gallery&view=thumbnails")
Instead of showing mysite.com/thumbnails it shows mysite.com/picture. The same thing happens if I am on the view thumbnail
and I do a JRoute::_("index.php?option=com_gallery&view=picture")
instead of showing the view picture
it shows the thumbnail
view which means it works only for the current view.
I have tried using the Router file that comes with Joomla (in the com_users folder) but I could not get it working for me as it extends JComponentRouterView
and the custom Router file I have for my component implements JComponentRouterInterface
.
I tried:
$this->registerView(new JComponentRouterInterface('thumbnails'))
and I got:
Call to undefined method GalleryRouter::registerView()
Obviously registerView
doesn't exist in JComponentRouterInterface
So I would like to know if there's any way to register or add my views to my router file or something I can do in order for them to be "recognised" in all views.
I'm currently using this workaround: JURI::base()."my-menu-item"