Weeblr wrote: Actually, after much digging, downloading a backup and debugging step by step, I found it's not the template. It's JFBConnect causing this (though I don't blame them entirely, the Joomla router is not doing a proper job there).
The full story is this:
- JFB has an OpenGraph plugin. This plugin is fired when the document is rendered, probably to insert OpenGraph meta data
- on line 214 of the file /components/com_jfbconnect/models/opengraphaction.php, they do:$queryVars = $router->parse($juri);
This causes the Joomla router to reset the Itemid. So instead of using our 404 error page Itemid, JFBConnect causes the Itemid to be reset to the home page, and the content is not displayed.
This can be fixed by replacing the above code with, for instance:$queryVars = JFactory::getApplication()->input->get->getArray();
which is the correct way according to Joomla API.
$queryVars = $router->parse($juri);
$jConfig->set('force_ssl', $forceSSL);
// Reset the router back to it's original state
$router->setVars($origVars);
Weeblr wrote:
nope, we do NOT override the core router. We follow Joomla API and only set up buildRules and parseRules.alzander wrote: It seems like sh404SEF is overriding the core-Joomla router, but not doing a full implementation.
We do not ignore it. As per the above, you are actually calling Joomla original setVars() function, in Joomla router. This method is not modified or altered in any way by sh404SEF.alzander wrote: However, we do a lot of work to get the information about the current route first and then we use the setVars() function to reset the router back to its previous state. sh404SEF's router seems to ignore the setVars call.
The problem is that calling setVars is NOT enough. It does reset (some) of the router state, but the router is unfortunately not "self-contained".When you do that, you only reset the router internal storage of variables, but you basically don't do anything else.
The problem is that the parse() method has side effects, external to the router itself:
$queryVars = $router->parse($juri);
This code actually reset the active menu in the Joomla menu object. In other words, you reset the current active menu globally for the whole app. Yes, Joomla should not to do that probably, but that's how it works. It's done in JRouterSite, in various locations:
if (isset($vars['Itemid'])) { $this->menu->setActive($vars['Itemid']); }
From reading your code, I understand the only you need is the current page query vars, which can be obtained safely through the Joomla API using:
$queryVars = JFactory::getApplication()->input->get->getArray();
I'm not sure what problem this very safe, read only method is causing to you. But I have spent quite some times stepping through the PHP code to be sure changing the currently active menu is causing the problem here.
As an alternate solution, maybe you could keep your current code, but in addition also reset the Itemid?
$router->setVars($origVars); if(!empty($origVars['Itemid']) { JFactory::getApplication()->getMenu()->setActive($origVars['Itemid']); }
Join our newsletter to get alerts for Joomla releases, tips and tricks and extension updates.