Jroute behavior in com_content article page when called outside the component

Did you find a bug in Joomla! 3.x but aren't sure? This forum is the place to help figure out if the problem is a bug and how to report it. If you are an experienced Joomla! user and are certain that you have found a bug please use the Bug Tracker to submit your issue.
This forum is for discussion about bugs and to get help with reporting them to the Bug Tracker: https://issues.joomla.org

Moderator: ooffick

Forum rules
Please use the official Bug Tracker to report a bug: https://issues.joomla.org
Locked
fsa13
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Jan 18, 2019 3:28 pm

Jroute behavior in com_content article page when called outside the component

Post by fsa13 » Fri Jan 18, 2019 3:45 pm

Related to Extension development.

In 3.9(.2) I have now noticed that in com_content Article page calling JRoute from template or modules, the normal JRoute gives an URL that is compounded from the current article page link:

Article URL: /jooma-site/category/article1
JRoute URL for another link normally: /joomla-site/category2
Above link when called the same JRoute in the Article page: /jooma-site/category/article1/category2

The actual JRoute in the Article layout [did a test by overriding the core article page layout] (or inside the component) works perfectly, e.g. give in the above example: /joomla-site/category2.

The problem happens only when using the same JRoute call outside the com_content component (e.g. template or module). In other com_content layout pages the outside call to JRoute works perfectly.

Adding or removing ItemId to/from the JRoute link has no effect.

Is this a valid bug?

madsdad
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Feb 13, 2019 7:05 am

Re: Jroute behavior in com_content article page when called outside the component

Post by madsdad » Wed Feb 13, 2019 7:44 am

I am seeing a similar problem with the Latest Articles module. Links appear to be built including the current url, rather than domain/index.php, prepended to the slug of the article. While Joomla finds the article, the resulting url includes a /category/ or a /current-page/ that does not belong.

domain/index.php/category/some/slug is incorrect when slug belongs to a different category.

This situation creates problems when, say, my custom plugin should affect articles of a certain category only.

fsa13
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Jan 18, 2019 3:28 pm

Re: Jroute behavior in com_content article page when called outside the component

Post by fsa13 » Wed Jun 26, 2019 6:43 pm

I discovered the reason for the initial problem of all JRoute::_ -links having the current URL as baseline. I had a call

Code: Select all

JURI::root( false, JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid))
inside the layout override template. This call seems to mix all JRoute-calls outside the layout template.


Locked

Return to “Joomla! 3.x Bug Reporting”